Change color

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
nico28
Posts: 5
Joined: 19 Jan 2007, 18:32
Location: France

Change color

Post by nico28 » 28 Mar 2007, 17:07

Hi.

I need to change the color of all elements in my DXF.
Example : all lines, circles, texts, ... , in Red.

How can i do that ?

nico28
Posts: 5
Joined: 19 Jan 2007, 18:32
Location: France

Post by nico28 » 28 Mar 2007, 17:27

I'am using CADImport.NET

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

Post by support » 30 Mar 2007, 11:17

Hello Nico!

Please use the following code (it is based on Viewer demo, find it in the ..\cadimportnet\sources\Viewer\.. folder):

Code: Select all

<font color="blue">private void</font id="blue"> btnChgColor_Click(<font color="blue">object</font id="blue"> sender, System.EventArgs e)
{
	<font color="blue">if</font id="blue">(<font color="blue">this</font id="blue">.FCADImage == <font color="blue">null</font id="blue">) <font color="blue">return</font id="blue">;
	<font color="blue">for</font id="blue"> (<font color="blue">int</font id="blue"> i = 0;i < <font color="blue">this</font id="blue">.FCADImage.Converter.GetCounts(CADImport.ConvSection.Entities); i++)
	{
		CADEntity entEntity = (CADEntity)<font color="blue">this</font id="blue">.FCADImage.Converter.GetSection(CADImport.ConvSection.Entities).Entities[i];

		<font color="blue">if</font id="blue"> ((entEntity <font color="blue">is</font id="blue"> CADLine) || (entEntity <font color="blue">is</font id="blue"> CADCircle) || (entEntity <font color="blue">is</font id="blue"> CADText))
		{
			
			entEntity.Color = Color.Aqua;
			<font color="blue">this</font id="blue">.cadPictBox.Invalidate();
		}
	}			
}
Sergey.

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

nico28
Posts: 5
Joined: 19 Jan 2007, 18:32
Location: France

Post by nico28 » 30 Mar 2007, 12:32

Hi and thank's for your response.
So, in my CADImport.dll (6.0.2603.19339), there is no CADEntity, no FCADImage.Converter. They are in the CADImport.NET Help but not in the DLL.

In you sample "Viewer",

#if Professional
private CADEntity selEnt;
...

What that "Professional" ? another version of the DLL ?

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

Post by support » 30 Mar 2007, 13:06

Directive <font color="blue">#if Professional</font id="blue"> has no concern to the access to entities' data.
For changing entities' properties extended version of CAD Import .NET is required.

Please write contact us on info@cadsofttools.com on this question.

Sergey.

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

Post Reply