create Image

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

create Image

Post by creepin » 20 Jan 2011, 16:24

Hey!

I tried to create a new Image without opening an existing file.

I tried it the following way:

Me.cadImageFld = New CADImage()
Me.cadImageFld.SelectionMode = SelectionEntityMode.Enabled
Me.cadImageFld.InitialNewImage()
Me.cadImageFld.UseWinEllipse = False

It opens a new image, but not correctly i think.
Not all Buttons and menubars are visible, the propertygrid does not work and zooming beneath 1500% makes created entities uneditable.

What is the correct way, to create a new image and load it into the cadpicturebox?
I am using the extended version 7

Many Thanks

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Re: create Image

Post by support » 21 Jan 2011, 12:01

Hello.
To create a new Image object the following code is enough:

Code: Select all

Me.cadImageFld = New CADImage()
Me.cadImageFld.InitialNewImage()
You don't need load CADImage in CADPictureBox. Image drawing specified in CADPictureBox.Paint event. Please see any of our demo applications source projects for details. Please note: PropertyGrid, buttons and menu bars aren't parts of CADPictureBox control. Please use CADViewerControl or CADEditorControl for widening control's basic functionality.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 21 Jan 2011, 15:20

Thank you for your reply.
But one thing is still incorrect. When drawing an entity on this image it is not editable or clickable under 1500% of zooming. over 1500% everything works properly, but beneath not. also drawing entites under 1500% does not work. On loaded images everything works fine.

You got an idea where this fault comes from?

Thank You

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Re: create Image

Post by support » 21 Jan 2011, 17:41

Hello.
Could you please specify CADImport.dll build number?

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 21 Jan 2011, 23:19

hello,

version is 7.2.6.23364 and runtime version is v2.0.50727

thanks for your help

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Re: create Image

Post by support » 24 Jan 2011, 13:50

Hello.
We have sent the latest CAD Import .NET release to your registration e-mail. Please inform us about issue status with this library version.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 24 Jan 2011, 16:34

The issue is still there with the new version. I am using the EditorControlDemo, modified for my purposes. I will send you the project via eMail.

Thanks.

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 26 Jan 2011, 23:55

I solved the problem:

there was

REM Me.cadImageFld.UseDoubleBuffering = False

instead of

Me.cadImageFld.UseDoubleBuffering = False

in the CreateNewImage Method, now it works as it should! Dont know where it came from.

Thanks a lot!

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Re: create Image

Post by support » 01 Feb 2011, 12:48

Hello.
CADImage.UseDoubleBuffering property specifies if metafile will be used as buffer to draw image. If true then drawing speed increased but image can't be edited.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 31 Mar 2011, 14:22

Hello. If found another Problem when creating a new image. So I open a new image, and save it without adding something to the image. When opening the so created file, the zoom is set to about 3000%, zomming back is just possible to aboaut 160% and the GetPoint method returns always (0,0),

When adding a insert referencing a block before saving the new image, and then reopneing it, everything works fine.

I used following code to create new image:

Me.cadImageFld= New CADImage
Me.cadImageFld.InitialNewImage()

I also tried to call the CreateNewImage method with the same result.

To save the dxf I use the standard Me.SaveAsDXF(filename) method

Did I miss something?

I attached 2 files, one which works properly (currentProject.dxf, one insert, one block) and one which is broken (currentProject(2).dxf, nothing drawn on it)
Maybe you can find the differences inside the files, or what i have done wrong.
Attachments
Archive.7z
(3.46 KiB) Downloaded 1445 times

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 31 Mar 2011, 15:45

I think I found a mistake. Try the following in your EditorDemo: Open a new file and then, without doing anything before click "Fit Drawing to window". then the same error occurs. So I think it has to do something with the getExtents Method, which I used before saving or doing anything. The EditorDemo i used was based on cadimport.dll version 7.2.7.26044

First adding something to the drawing and then fit drawing to window does not make occur the error. but adding,deleting and then calling fit drawing to window, raises the fault again.

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Re: create Image

Post by support » 31 Mar 2011, 17:03

Hello.
There is no any error or issue. CADImage object that doesn't contain any entities have null extents.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 31 Mar 2011, 17:16

Yeah thats true, but calling this method when no entity is in drawing, makes the image unusable. I can't use it anymore, if i cant zoom beneath 160% and the getpoint method returns always (0,0). So the getextents method should do nothing if there is no entity in it, and not doing strange things to the image.

The only thing i could do is, to make an if condition and just call the getextents method when there is more than 0 entitiea in the entities converter. But I think that must be catched directly within the cadimage.getextents method.

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Re: create Image

Post by support » 31 Mar 2011, 17:39

Hello.
If CADImage have null extents then GetPoint returns (0, 0) point correctly. Also Fit drawing to window or getting extents doesn't have meaning because zero can't be placed to some percents. Why need such method to empty image?

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

creepin
Posts: 19
Joined: 20 Nov 2010, 00:27

Re: create Image

Post by creepin » 31 Mar 2011, 17:49

Hello,

I create a new empty image, and then the user can add a reference to file using the addscaledRefEX method. after that the getextents method is called. if he now wants to save that without drawing anything on it before, you can not open the file anymore correctly.

Post Reply