Use of CADGroup Object example?

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
SLMaxwell68
Posts: 4
Joined: 22 Aug 2007, 17:56
Location: USA
Contact:

Use of CADGroup Object example?

Post by SLMaxwell68 » 01 Sep 2007, 01:42

Using the CAD Import .NET (pro/extended) library in C#...

Could I see a breif example on the proper use of the CADGroup object?

I have attempted adding entities to the group and the group to the converter - but the entities do not display within the drawing?

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

Post by support » 03 Sep 2007, 11:00

Hello!

<b>CADGroup</b> is not a visual object. That is why added entities could not be displayed.

We recommend to use classes <b>CADBlock</b> and <b>CADInsert</b>. Do you need an example?

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

SLMaxwell68
Posts: 4
Joined: 22 Aug 2007, 17:56
Location: USA
Contact:

Post by SLMaxwell68 » 04 Sep 2007, 16:38

Yes please.

When testing the groups - we also tried the CADBlock objects without success. We are obviously not setting-up/using the Block object correctly as the results with this object were the same as with the group. We did not attempt to use the CADInsert object yet.

Examples of both/or either the Block and Insert would be very beneficial.

Thanks in advance,
Scott M.

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

Post by support » 05 Sep 2007, 11:30

Hello Scott,

Please try the following code:

Code: Select all

	<font color="green">//add line</font id="green">
	CADLine ln1 = <font color="blue">new</font id="blue"> CADLine();
	ln1.Color = Color.Red;
	ln1.Point = <font color="blue">new</font id="blue"> DPoint(10, 10, 0);
	ln1.Point1 = <font color="blue">new</font id="blue"> DPoint(20, 20, 0);
	ln1.Loaded(this.FCADImage.Converter);
	<font color="blue">this</font id="blue">.FCADImage.Converter.OnCreate(ln1);
	
	<font color="green">//add attdef</font id="green">
	CADAttrib entAttrib = <font color="blue">new</font id="blue"> CADAttrib();
	entAttrib.Tag = "Tag Faska";
	entAttrib.Text = "Text Bolt";
	<font color="blue">this</font id="blue">.FCADImage.Converter.Loads(entAttrib);

	<font color="green">//add block</font id="green">
	CADBlock bl1 = <font color="blue">new</font id="blue"> CADBlock();			
	bl1.Name = "MyBlock";
	bl1.Color = Color.Red;
	bl1.Visibility = <font color="blue">true</font id="blue">;			
	bl1.AddEntity(ln1);				
	<font color="blue">this</font id="blue">.FCADImage.Converter.Blocks.Add(bl1);
	<font color="blue">this</font id="blue">.FCADImage.Converter.OnCreate(bl1);
	<font color="blue">this</font id="blue">.FCADImage.Converter.Loads(bl1);
			
	<font color="green">//add insert</font id="green">
	CADInsert ins1 = <font color="blue">new</font id="blue"> CADInsert();
	ins1.Angle = 130;
	ins1.Block = bl1;
	ins1.Point = <font color="blue">new</font id="blue"> DPoint(10, 10, 0);
	ins1.Visibility = <font color="blue">true</font id="blue">;
	ins1.AddEntity(entAttrib);
	<font color="blue">this</font id="blue">.FCADImage.Converter.Entities.Add(ins1);
	<font color="blue">this</font id="blue">.FCADImage.Converter.OnCreate(ins1);
	<font color="blue">this</font id="blue">.FCADImage.Converter.Loads(ins1);
	<font color="blue">this</font id="blue">.cadPictBox.Invalidate();
Sergey.

Please post questions to the forum or write to support@cadsofttools.com

SLMaxwell68
Posts: 4
Joined: 22 Aug 2007, 17:56
Location: USA
Contact:

Post by SLMaxwell68 » 11 Sep 2007, 18:34

Sergey,

Thank you for the example!!!

We were not linking the insert object correctly.

Very helpful!

Post Reply