cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to get only edges belonging to a solid?

WK_9857356
5-Regular Member

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

 

 

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

6 REPLIES 6
sjuraj
15-Moonstone
(To:WK_9857356)

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.

WK_9857356
5-Regular Member
(To:sjuraj)

it is in prt

FV
17-Peridot
17-Peridot
(To:WK_9857356)

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

sjuraj
15-Moonstone
(To:FV)

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

WK_9857356
5-Regular Member
(To:sjuraj)

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

 

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

Announcements


Top Tags