Skip to main content
1-Visitor
January 24, 2022
Solved

How to get only edges belonging to a solid?

  • January 24, 2022
  • 2 replies
  • 3208 views

Currently using the below Java code I am getting many more edges compared to searching for edges in the GUI (ctrl+f, look for:edge)

Where are all the extra edges coming from?

 

Session currSession= pfcSession.GetCurrentSessionWithCompatibility (CreoCompatibility.C4Compatible);
Model currModel = currSession.GetCurrentModel();
Solid currSolid = (Solid)currModel;
ModelItems edgeItems = currSolid.ListItems(ModelItemType.ITEM_EDGE);
int edgeItemsNum = edgeItems.getarraysize();

 

 

Best answer by YaroslavSin

toolkit eges.png

For free Java you can try this:

1. List all features.

2. GetIsVisible ()

3. Check a feature type (for example, to exclude not solid surfaces)

4. List sub items for the feature ListSubItems()

2 replies

15-Moonstone
January 24, 2022

Are you listing items in asm or prt ? .. you can insert selected items to buffer to see in gui what edges are selected. If nothing help you can use macro to select edges through ctrl+f and then fire another macro (your command) to do the job.

1-Visitor
January 25, 2022

it is in prt

17-Peridot
January 24, 2022

ProGeomitemIsInactive(...) will filter out inactive edges.

15-Moonstone
January 25, 2022

But, IsInactive() method belongs to FeatureStatus object, which is in paid version of jlink, so you will have to do some workaround

1-Visitor
January 25, 2022

Yes, I am using only Java Free

The workaround I currently have is to test each edge to check for two connected surfaces, though this seems to make my code run quite slow given the number of edges to check

While this works to an extend, there is still some differences, for example for one of my models:

(1) ctrl+f = 9069 edges

(2) above code = 31,587 edges

(3) above code + test for connected surfaces = 9011

I am hoping to find a more efficient way to do this