Skip to main content
Jan 24, 2022 6:08 AM UTC
Solved

How to get only edges belonging to a solid?

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();

 

 

Jan 25, 2022 7:44 AM UTC

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()

6 replies

Jan 24, 2022 10:43 AM UTC

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.

Jan 25, 2022 5:52 AM UTC

it is in prt

Jan 24, 2022 5:46 PM UTC

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

Jan 25, 2022 4:32 AM UTC

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

Jan 25, 2022 5:52 AM UTC

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