Message 1 of 12
Not applicable
01-27-2016
01:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I'm developing with VB.Net and Inventor using a standalone exe that grabs or creates inventor app. I have reached an impass with trying to find the propery way to project entities (AddByProjectingEntity) from an assembly's origin to a sketch created from the base view's sketch collection's add routine. What I have attempted is below:
Dim vSide As DrawingView = shClearance.DrawingViews.AddBaseView(ClearanceModel, pntSideView, CDbl(1 / 40), ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle, "SIDE VIEW")
Dim wporigin As WorkPoint = SetWorkPointVisibility(vSide, "Center Point", True)
Dim pOrigin As SketchPoint = skSection.AddByProjectingEntity(wporigin)
Public Function SetWorkPointVisibility(ByRef v As DrawingView, ByRef wpName As String, ByVal visibility As Boolean) As WorkPoint
Dim doc As Inventor.Document = v.ReferencedDocumentDescriptor.ReferencedDocument
Dim cd As ComponentDefinition = Nothing
If doc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
cd = CType(doc, AssemblyDocument).ComponentDefinition
ElseIf doc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
cd = CType(doc, PartDocument).ComponentDefinition
End If
Dim wp As WorkPoint = FindWorkPoint(cd, wpName)
If wp IsNot Nothing Then
v.SetVisibility(wp, True)
Return wp
End If
Return Nothing
End Function
Public Function FindWorkPoint(ByRef cd As ComponentDefinition, ByVal wpName As String) As WorkPoint
Dim wps As WorkPoints = Nothing
If cd.Type = ObjectTypeEnum.kAssemblyComponentDefinitionObject Then
Dim acd As AssemblyComponentDefinition = cd
wps = acd.WorkPoints
ElseIf cd.Type = ObjectTypeEnum.kPartComponentDefinitionObject Then
Dim pcd As PartComponentDefinition = cd
wps = pcd.WorkPoints
End If
If wps IsNot Nothing Then
For Each wp As WorkPoint In wps
If wp.Name = wpName Then Return wp
Next
End If
Return Nothing
End Function
I can't find any example, sample or blog with a direct example. Any guidance would be helpful. Thanks,
Solved! Go to Solution.
