- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Help! I am trying to project geometry (a floor plan) onto a DrawingSketch using the AddByProjectingEntity method. The active document is a Drawing; I have created the DrawingSketch from the active view. Yet nothing I try seems to work. Can it really be that difficult? A sample of one of my attempts follows. What am I missing?
'Get the drawing document.
Dim thisDwg As DrawingDocument = InvApp.ActiveDocument
'Get the sheet.
Dim thisSheet As Sheet = thisDwg.ActiveSheet
'Get the active view.
Dim thisView As DrawingView = thisSheet.DrawingViews.Item(1)
'Create a sketch.
Dim thisDwgSketch As DrawingSketch = thisView.Sketches.Add
'Start editing the sketch.
thisDwgSketch.Edit()
'Get the referenced assembly document.
Dim AssyDoc As AssemblyDocument = thisView.ReferencedDocumentDescriptor.ReferencedDocument
Dim AssyCompDef As AssemblyComponentDefinition = AssyDoc.ComponentDefinition
Dim Backstop1 As ComponentOccurrence = AssyCompDef.Occurrences.Item(1)
Dim Gym1 As ComponentOccurrence = Nothing
For Each Gym1 In Backstop1.Definition.Occurrences
If InStr(Gym1.Name, "GYM") Then
Exit For
End If
Next
Dim oOccur As ComponentOccurrence = Nothing
For Each oOccur In Gym1.Definition.Occurrences
If InStr(oOccur.Name, "WALLS") Then
For Each SurfBody As SurfaceBody In oOccur.SurfaceBodies
For Each oEdge As Edge In SurfBody.Edges
Dim anObject As Object = Nothing
oOccur.CreateGeometryProxy(oEdge, anObject)
thisDwgSketch.AddByProjectingEntity(anObject)
Next
Next
Exit For
End If
Next
thisDwgSketch.ExitEdit()
Software Programmer
Draper, Inc.
Solved! Go to Solution.