Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Creating a polyhedron using the API

Valued Contributor
Valued Contributor

I would like to create a polyhedron from an array of coordinates using the API. Initially, this will have 6 faces, but will not be a regular shape (i.e. not a prism), so I cannot use CreateSolidByExtrude on a polyline.

 

I have tried to do this by creating each face of the polyhedron, but TxComponent.CreatePlane throws an error. This problem is also described here:

 

https://community.plm.automation.siemens.com/t5/Tecnomatix-Developer-Forum/I-would-like-to-create-pl...

 

but the solution provided only produces a rectangle as a plane.

 

Is it possible to create an irregular polyhedron with an arbitrary number of sides? If so, how can this be achieved?

 

If not, is it possible to create arbitrary planes which I can then sit together in the same TxComponent and treat that as a polyhedron?


Thanks in advance.

4 REPLIES

Re: Creating a polyhedron using the API

Creator
Creator
Have you try sweep API ?

Create profile:
TxSolidSweepCreationData.TxProfile
Create guide:
TxLine

Create solid
TxSolidSweepCreationData

Re: Creating a polyhedron using the API

Valued Contributor
Valued Contributor

I've not tried sweep yet. Do you have a simple example I can see?

 

Thanks

Re: Creating a polyhedron using the API

Creator
Creator

// Here is example for create swept solid

 

// Get factory

ITxGeometryCreation fact = TxApplication.ActiveDocument.CurrentModelingWorkingSpace as ITxGeometryCreation;

 

// Create polyline

TxPolylineCreationData creationData = new TxPolylineCreationData();
ArrayList list = new ArrayList();
list.Add(new TxVector(0,0,0));
list.Add(new TxVector(100,0,0));
list.Add(new TxVector(0,100,0));
creationData.PointsList = list;
TxPolyline pl = fact.CreatePolyline(creationData);

 

// Create guide

TxLineCreationData lineData = new TxLineCreationData();
lineData.StartPoint = new TxVector(0,0,0);

lineData.EndPoint = new TxVector(0,0,100);

TxLine guide = fact.CreateLine(lineData);

 

// Create swept solid

TxSolidSweepCreationData.TxProfile profile = new TxSolidSweepCreationData.TxProfile(pl);
TxSolidSweepCreationData sweepdata = new TxSolidSweepCreationData();
sweepdata.AddProfile(profile);
sweepdata.GuidingCurve = guide;

 

TxSolid solid = factory.CreateSolidBySweep(sweepdata);

Re: Creating a polyhedron using the API

Valued Contributor
Valued Contributor

Thank you!

 

I hope Tecnomatix.NET.chm will eventually contain tiny worked examples like this! :-)