3D Face Using More Than 4 Points

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Paul Goldberg
Posts: 2
Joined: 22 Feb 2007, 20:18

3D Face Using More Than 4 Points

Post by Paul Goldberg » 23 Feb 2007, 03:59

Hello,

I need to be able to create a CAD3DFace but using more than 4 Points like the CADPolyLine. Can you please help me to understand how to accomplish this.

I used the viewer to examine a CADPolyLine created from software which displays faces. These faces are actually represented in the DXF file as a complex CADPolyLine. This CADPolyLine contains definitions for Meshes and Vertexes.

My Question: Is it possible to create a similar CADPolyLine (like a Face) which contains vertex and mesh data defined automaticaly for more thans 4 points.

Thanks
Paul Goldberg

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

Post by support » 27 Feb 2007, 18:13

Dear Mr. Paul Goldberg,

The following code allows creating Polyface Mesh entity:

Code: Select all

<font color="blue">private void</font id="blue"> btnAddPolyfaceMesh_Click(<font color="blue">object</font id="blue"> sender, System.EventArgs e)
{	
	if(FCADImage == null)
		return;
			
	<font color="blue">this</font id="blue">.FCADImage.CurrentLayout = <font color="blue">this</font id="blue">FCADImage.Converter.Layouts[0];

	CADPolyLine Polyline = <font color="blue">new</font id="blue"> CADPolyLine();
	Polyline.Flags = 64;<font color="green">// the POLYLINE is a polyface mesh</font id="green">
	Polyline.MeshM = 10;<font color="green">// number of vertices</font id="green">
	Polyline.MeshN = 3;<font color="green">// number of faces</font id="green">
	<font color="green">// vertices</font id="green">
	Add3DVertex(Polyline, 157, 177, 0);
	Add3DVertex(Polyline, 190, 196, 0);
	Add3DVertex(Polyline, 223, 176, 0);
	Add3DVertex(Polyline, 209, 203, 0);
	Add3DVertex(Polyline, 234, 218, 0);
	Add3DVertex(Polyline, 201, 218, 0);
	Add3DVertex(Polyline, 190, 244, 0);
	Add3DVertex(Polyline, 179, 219, 0);
	Add3DVertex(Polyline, 148, 219, 0);
	Add3DVertex(Polyline, 172, 204, 0);
	<font color="green">// faces</font id="green">
	AddFaceByVertices(Polyline, 1, 5, 8, 0);
	AddFaceByVertices(Polyline, 3, 7, 10, 0);
	AddFaceByVertices(Polyline, 9, 8, 10, 0);
	Polyline.Color = Color.Red;<font color="green">// color</font id="green">		
	Polyline.Loaded(<font color="blue">this</font id="blue">.FCADImage.Converter);
	<font color="blue">this</font id="blue">.FCADImage.CurrentLayout.Entities.Add(Polyline);
	<font color="blue">this</font id="blue">.FCADImage.Converter.OnCreate(Polyline);
}

<font color="blue">private void</font id="blue"> Add3DVertex(CADPolyLine Polyline, <font color="blue">double</font id="blue"> X, <font color="blue">double</font id="blue"> Y, <font color="blue">double</font id="blue"> Z)
{
	CADVertex Vertex = <font color="blue">new</font id="blue"> CADVertex();		
	Vertex.Point = <font color="blue">new</font id="blue"> DPoint(X, Y, Z);
	Polyline.AddEntity(Vertex);		
}

<font color="blue">private void</font id="blue"> AddFaceByVertices(CADPolyLine Polyline, <font color="blue">int</font id="blue"> N1, <font color="blue">int</font id="blue"> N2, <font color="blue">int</font id="blue"> N3, <font color="blue">int</font id="blue"> N4)
{
	CADVertex Vertex = <font color="blue">new</font id="blue"> CADVertex();            
	Vertex.PolyFaceVertexIndex1  = N1;
	Vertex.PolyFaceVertexIndex2  = N2;
	Vertex.PolyFaceVertexIndex3  = N3;
	Vertex.PolyFaceVertexIndex4  = N4;
	Vertex.Flags = 128;
	Polyline.AddEntity(Vertex);
}
Sergey

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

Paul Goldberg
Posts: 2
Joined: 22 Feb 2007, 20:18

Post by Paul Goldberg » 03 Mar 2007, 01:44

Hi Sergey,

This helps me to understand the process for adding a face using CADImport.

Unfortuneately when I asked the question I did not realize CADExport was seperate and was needed to create DXF files. Can you please give me the same process when using CADExport class.

I have not been able to find the correspoding properties for DFXData and DXFPolyLine which allow the setting of MeshM, MeshN etc.. The only technique I have found to add PolyLines is using DXFEXport.AddPolyLine(Data,0);


Thanks for your previous reply.

Paul Goldberg

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

Post by support » 05 Mar 2007, 10:28

Hi Paul,

Current <b>DXFExport .Net</b> does not allow defining the following fields:

Polyline.Flags = 64;// the POLYLINE is a polyface mesh
Polyline.MeshM = 10;// number of vertices
Polyline.MeshN = 3;// number of faces

We work on new product DirectExport which will have the same flexibility as <b>CADImport .Net</b>.

We will inform you when it will be available.

Sergey.

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

adduzz
Posts: 2
Joined: 11 Mar 2007, 15:46
Location: Saudi Arabia

Post by adduzz » 12 Mar 2007, 09:03

Yea... support is always rite..!! :-)

but I want to ask one thing: that is I couldnt find CADPolyLine class in CADImport library/DLL.. I have CADImport v6.0.2603.19339, am I using an incorrect version?

please Help me..!

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

Post by support » 12 Mar 2007, 09:26

Hello!

It is necessary to use extended version of CAD Import .NET. Please contact us on this question to info@cadsofttools.com.

Sergey.

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

Post Reply