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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Extracting Dimension from Creo model

ms-6
6-Contributor

Extracting Dimension from Creo model

Hi all,

     I need to get the list of dimension used in the Creo model with reference to specific surface. For example, I have hole feature and i need to get all the dimension with reference to the hole.

Kindly suggest me

10 REPLIES 10
gwang-5
1-Newbie
(To:ms-6)

Hi Man.

I have the same problem, and want to find a easy to extract dimension from model.

Have got the the solutions? could you share it to me if you got it?

Thank you very much!

Regards.

Roger.

Hi You can use

ProSelectionModelitemGet

ProDimensionValueGet.

Hi brother,

Thank you so much! Is this function based on toolkit? Can we use it based on vb api? Can you give me a example?

Thanks a lot~

Regards,

Roger.

Hi Roger:

Both functions are based on toolkit. I am not sure about VB. Try this code:

ProError err;

double value = 0.0;

ProSelection *sel;

ProDimension dim;

err = ProSelectionModelitemGet (sel[0], &dim);

err = ProDimensionValueGet (dim, &value);

Try this. I think this should do. Let me know how this goes

Regards

Prem

GabrielZaha
12-Amethyst
(To:ms-6)

For Toolkit you can use ProSolidDimensionVisit to get the dimension from the entire model or ProFeatureDimensionVisit to get the dimension of a specific feature.

For VB API you can try IpfcModelItemOwner.ListItems() or IpfcFeature.ListSubItems(). Check the "Getting ModelItem Objects" section on the user guide.

Those two methods will give you a list of dimension objects(model items). From here you can use the IpfcBaseParameter and IpfcBaseDimension methods to get the informations you need.

The <Creo Load point>\vbapi\vbapi_examples\pfcRelationsExamples.vb file has an example of getting dimension list by using IpfcFeature.ListSubItems()

Thanks both Gabriel and Prem,

I will try to test it, thanks a lot!

Regards

Roger.


kbabu-2
1-Newbie
(To:ms-6)

Hello,

Let understand background....API's provided in toolkit or vb are to get the dimensions of the feature created.You can not get dimension on fly w.r.t to one modelitem to other item. But where as in drawing it is very much possible if you can get valid objects to create drawing dimensions in a view.In model you can measure distance between two objects as it has creo features....similary explore API are support on this.

Hi Guys,

I want count the current opened drawing attributes list count using VB.net. I have experience in vb.net/api, little bit experience in creo api.

Drawing Attributes:

1. Dimension

2. Note

3. Geom tol

4. 2D datum/axis

5. 2D sketched entity

6. Reference dim

7. Surface finish

8. 2D symbol

The above list count to be taken using vb.net. I have analyzed  vbug.pdf and i didn't' get clear idea. I opened the drawing file.

Now i want to go further process.

Can anyone help me.

Thnks

Balaji somasundaram

Follow the below steps:

  1. Connect the Base Session
  2. Get the Current Model as IpfcModel
  3. Cast the IpfcModel as IpfcDrawing
  4. Cast the IpfcDrawing as IpfcModel2d
  5. List out the IpfcModels from IpfcModel2d
  6. Use Every IpfcModel2d as IpfcModelItemOwner
  7. List out the IpfcModelItems
  • Use the IpfcModelType → Here what you need (Dimension, Note, Symbol, etc)
  • Note - you can use Leader Attachment Type

Count the items with your VB Code

Parthiban Kannan

href="https://www.linkedin.com/in/parthiban-kannan/" target="_blank"
avijayan-2
12-Amethyst
(To:ms-6)

Hi,

 

I hope the below code will help you up.

 

Dim model As IpfcModel
Dim solid As IpfcSolid
Dim holes As IpfcFeatures
Dim hole As IpfcFeature
Dim dimensions As IpfcModelItems
Dim dimension As IpfcDimension


model = session.CurrentModel
Solid = CType(model, IpfcSolid)

holes = solid.ListFeaturesByType(True, EpfcFeatureType.EpfcFEATTYPE_HOLE)      " This will give you the whole list of holes present in your model"

For i = 0 To holes.Count -1

hole = holes.Item(i)     "Now it will go through each holes. If you want to check any perticular hole. You can do that by using the Feat-Id of the hole"

dimensions = hole.ListSubItems(EpfcModelItemType.EpfcITEM_DIMENSION)

For j= o to dimensions.Count -1

dimension = dimensions.Item(j)

Next
Next

 

 

Top Tags