본문 바로가기
  • Welcome!
VBA, VB.NET For Creo

Creo] Get the dimensions that the model's features have

by ToolBOX01 2025. 1. 29.
반응형

□Get dimensions included in a feature

  • Get Features from the model.
  • Get the dimensions contained in a Feature.

▷ Code:]

  • After deploying the udf, you can modify the dimensions included in the feature.
  • You can get the parameter names and values ​​included in the feature(Blog).
  • When you deploy a udf, the user defined dimension names are automatically changed to the Creo system dimension names.
  • You can get dimension names and values ​​of datum sketch curve features in an assembly.
Dim ws As Worksheet
Dim Model As pfcls.IpfcModel
Dim ModelItemOwner As pfcls.IpfcModelItemOwner
Dim DimModelItemOwner As pfcls.IpfcModelItemOwner
Dim ModelItems As pfcls.IpfcModelItems
Dim DimModelItems As pfcls.IpfcModelItems
Dim ModelItem As pfcls.IpfcModelItem
Dim Feature As IpfcFeature
Dim i As Integer

Sub getFeatureDimension()

     '// Creo Connection
    Call CreoVBAStart02.CreoConnt02
    
    Dim ws As Worksheet
    Dim Model As pfcls.IpfcModel
    Dim ModelItemOwner As pfcls.IpfcModelItemOwner
    Dim DimModelItemOwner As pfcls.IpfcModelItemOwner
    Dim ModelItems As pfcls.IpfcModelItems
    Dim DimModelItems As pfcls.IpfcModelItems
    Dim ModelItem As pfcls.IpfcModelItem
    Dim Feature As IpfcFeature
    Dim i As Integer
    Dim j As Integer
    
    Set ws = ThisWorkbook.Worksheets("getDimension")
    Set Model = BaseSession.CurrentModel
    Set ModelItemOwner = Model
    Set ModelItems = ModelItemOwner.ListItems(EpfcModelItemType.EpfcITEM_FEATURE)
    
    For i = 0 To ModelItems.Count - 1
            Set Feature = ModelItems.Item(i)
            Set DimModelItems = Feature.ListSubItems(EpfcModelItemType.EpfcITEM_DIMENSION)
            
            For j = 0 To DimModelItems.Count - 1
                   Set BaseDimension = DimModelItems.Item(j)
                   Debug.Print Feature.Number
                   Debug.Print BaseDimension.Symbol
            Next j
    Next i
End Sub

by korealionkk@gmail.com

Creo Model Execution results
  • The VBA program searches in the following order: model objects, Feature objects, and dimension objects.
  • You can search all dimensions included in the model by Feature ID.
  • You can compare cases where dimension names, dimension quantities, and dimension values ​​are different by Feature ID in similar models.
  • The model's information can be stored in a database, allowing you to create a separate comparison search program.
  • It will be possible to create a comparative search program using AI.
  • Imagine, what if AI could understand the data stored in your database, make predictions while you’re modeling in Creo, and provide a model that looks like the part the designer is trying to create?

'VBA, VB.NET For Creo' 카테고리의 다른 글

IpfcSurface  (0) 2025.02.01
Creo] IpfcModel  (0) 2025.02.01
Creo] Get drawing information - 작업중  (0) 2025.01.27
CREO] Get selected Folder and file names  (0) 2025.01.26
Creo] Running Creo in the background  (0) 2025.01.25