Skip to main content
1-Visitor
November 30, 2020
Solved

How to extract Dimension Texts from a CREO drawing using VB API?

  • November 30, 2020
  • 1 reply
  • 3009 views

Iam able to extract text from symbols and detail notes by getting a handle of notes/symbol using the following code,
modelitems =  detailItemOwner.ListDetailItems(EpfcDetailType.EpfcDETAIL_NOTE, 1)

Now i need to extract Dimension Texts from a drawing.
the modeItems that are returning from the above code does not contain dimension texts

Any idea on how to extract those informations?

 

HanSolo97_0-1606744153519.png

 

Best answer by HanSolo97

Found the solution myself
For anyone else having the same problem. here you go

 

For m = 0 To session.ListModels.Count - 1


model = session.ListModels.Item(m)
Dim ModType As Integer = model.Type

If model.Type = 1 Or model.Type = 0 Then

MIowner = CType(model, IpfcModelItemOwner)
MIs = MIowner.ListItems(EpfcModelItemType.EpfcITEM_DIMENSION)


For i = 0 To MIs.Count - 1


dimension = MIs.Item(i)
dimensions = dimension

shXL.Cells(J, 1) = dimensions.Symbol
shXL.Cells(J, 2) = dimensions.DimValue.ToString
shXL.Cells(J, 3) = model.FileName

Dim texts As Cstringseq = dimensions.Texts

For t = 0 To texts.Count - 1
str = str & texts.Item(t)
Next
shXL.Cells(J, 4) = str

J = J + 1

End Try

Next

End If
Next  

1 reply

HanSolo971-VisitorAuthorAnswer
1-Visitor
December 1, 2020

Found the solution myself
For anyone else having the same problem. here you go

 

For m = 0 To session.ListModels.Count - 1


model = session.ListModels.Item(m)
Dim ModType As Integer = model.Type

If model.Type = 1 Or model.Type = 0 Then

MIowner = CType(model, IpfcModelItemOwner)
MIs = MIowner.ListItems(EpfcModelItemType.EpfcITEM_DIMENSION)


For i = 0 To MIs.Count - 1


dimension = MIs.Item(i)
dimensions = dimension

shXL.Cells(J, 1) = dimensions.Symbol
shXL.Cells(J, 2) = dimensions.DimValue.ToString
shXL.Cells(J, 3) = model.FileName

Dim texts As Cstringseq = dimensions.Texts

For t = 0 To texts.Count - 1
str = str & texts.Item(t)
Next
shXL.Cells(J, 4) = str

J = J + 1

End Try

Next

End If
Next