Highlighted

Reading drawing data

Hello

 

I am trying to use Visual Basic to read data from a Solid Edge Part.

I can read variables and dimensions but I think reading features would be better.

My aim is to link a drawing to a manufacturing process, similar to CAD-CAM but covering more processes.

 

Is there existing software or parts of applications that could give me a good starting point please.

 

Many thanks.

 

Ian

 

Extract:-

' Get a reference to the variables collection

objVariables = objPart.Variables

 

VarCount = objVariables.Count

For i = 1 To VarCount

'MsgBox(objVariables.Item(i).ToString)

objVariable = objVariables.Item(i)

If objVariable.Properties = 1693 Then

sValue = objUOM.FormatUnit(UnitTypeConstants.igUnitDistance, objVariable.Value.ToString)

Else

sValue = objVariable.Value.ToString

End If

Variables.Items.Add(i.ToString + ") " + _

objVariable.Type.ToString + _

" ->" + objVariable.ExposeName + _

" ->" + objVariable.Properties.ToString + _

" ->" + objVariable.GetComment + _

" <> " + objVariable.Value.ToString + _

" = " + sValue)

'MsgBox(objVariable.Name + " <> ") ' + objVariable.Value.ToString)

Next

 

 

' Get a reference to the Profile collection

objProfileSets = objPart.ProfileSets

TotalSets = objProfileSets.Count

SetCount = 1

For i = 1 To TotalSets

TotalProfs = objProfileSets.Item(SetCount).Profiles.Count

ProfCount = 1

For ii = 1 To TotalProfs

sName = objProfileSets.Item(i).Name + " & " + objProfileSets.Item(i).Profiles.Item(ii).Name

Variables.Items.Add(String.Format("Profile Name = {0}", sName))

 

objProfile = objProfileSets.Item(i).Profiles.Item(ii)

' Get a reference to the dimensions collection

objDimensions = objProfile.Dimensions

DimCount = objDimensions.Count

For iii = 1 To DimCount

objDimension = objDimensions.Item(iii)

sName = objDimension.Name + " & " + objDimension.SystemName

Variables.Items.Add(String.Format("Dimension = {0}", sName))

sFormula = objDimension.Formula

Variables.Items.Add(String.Format("Formula = {0}", sFormula))

'dValue = objDimension.Value

sValue = objUOM.FormatUnit(UnitTypeConstants.igUnitDistance, objDimension.Value.ToString)

Variables.Items.Add(String.Format("Value = {0}", sValue))

Next iii

Next ii

Next i

 

Posted by: Ian Burrows
Post date: 3/15/2012 11:02:29 AM

1 REPLY

Re: Reading drawing data

Yes! It is possible to find the number of features in a part. You can define a part then define objfeatures in a part or document and you can find for each objfeature in objfeatures…

 

Sandeep Shewale

 

Posted by: Sandeep Shewale
Post date: 4/2/2012 7:03:25 AM