Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am trying to add dimensions to an assembly. The relevant faces within the parts are named. I manage to get the components but I cannot get the drawing curves. Here is my code:
' Adding Dimensions Dim oAssembly As AssemblyDocument oAssembly = oSideView.ReferencedDocumentDescriptor.ReferencedDocument Dim oModelDoc As Document Dim Face1 As Face Dim Face2 As Face For i = 1 To oAssembly.ReferencedDocuments.Count oModelDoc = oAssembly.ReferencedDocuments(i) If oModelDoc.AttributeManager.FindObjects("*", "*", "Nutenseite1").Count > 0 Then Face1 = oModelDoc.AttributeManager.FindObjects("*", "*", "Nutenseite1").Item(1) MessageBox.Show("Found: " & Face1.InternalName()) ' this works! Named Object found! End If If oModelDoc.AttributeManager.FindObjects("*", "*", "Nutenseite2").Count > 0 Then Face2 = oModelDoc.AttributeManager.FindObjects("*", "*", "Nutenseite2").Item(1) End If Next Dim oOccFace1Proxy As FaceProxy Dim oOccFace2Proxy As FaceProxy Dim oCompOcc As ComponentOccurrence oCompOcc = oAssembly.ComponentDefinition.Occurrences.ItemByName("Einlaufpfostenprofil") MessageBox.Show("Selected Component: " & oCompOcc.Name()) 'Works! Call oCompOcc.CreateGeometryProxy(Face1, oOccFace1Proxy) 'no error msg here. Programm does not fail Call oCompOcc.CreateGeometryProxy(Face2, oOccFace2Proxy) 'no error msg here. Programm does not fail Dim myCurveCandidates As DrawingCurvesEnumerator = oSideView.DrawingCurves(oOccFace1Proxy) MessageBox.Show(oSideView.DrawingCurves(oOccFace1Proxy).Count) 'gives me a zero Dim myDrawingCurve As DrawingCurve = myCurveCandidates.Item(1) 'fails Dim face1GeoIntent As GeometryIntent = oSheet.CreateGeometryIntent(myDrawingCurve) myCurveCandidates = oTopView.DrawingCurves(oOccFace2Proxy) myDrawingCurve = myCurveCandidates.Item(1) Dim face2GeoIntent As GeometryIntent = oSheet.CreateGeometryIntent(myDrawingCurve) Dim widthDimPoint As Point2d = oTG.CreatePoint2d(15, 10) oSheet.DrawingDimensions.GeneralDimensions.AddLinear(widthDimPoint,face1GeoIntent,face2GeoIntent)
Solved! Go to Solution.