Message 1 of 2

Not applicable
01-27-2016
08:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I thought this would be simple, projecting a centerpoint from a view's underlying reference document's assembly origin into a sketch created on the view.
I keep getting invalid parameter error. Since the object is of the first layer, I shouldn't need (nor can i create) a proxy version of it. Does anybody know how to fix this?
'excerpt inline of main routine Dim wporigin As WorkPoint = SetWorkPointVisibility(vSide, "Center Point", True) Dim skSection As DrawingSketch = vSide.Sketches.Add() Dim pOrigin As SketchPoint = skSection.AddByProjectingEntity(wporigin) 'called helper routines 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
Solved! Go to Solution.