- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm trying to add a center line in my drawing, i'm using a work point to insert the sketch symbol (center Line) and same work point for addressing the dimensions too.
My question here is can i insert the sketch symbol (Center line) based on a work point position? If Yes, How can I?
How can I give the work point or work point Proxy as a reference co-ordinates for my sketch symbol Insertion point?.
Code Below:
sub DIMENSIONS()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet
Dim oView As DrawingView
Set oView = oSheet.DrawingViews(1)
Dim oAssDoc As AssemblyDocument
Set oAssDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oAssCompDef As AssemblyComponentDefinition
Set oAssCompDef = oAssDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence
Dim oOccs As ComponentOccurrences
Set oOccs = oAssDoc.ComponentDefinition.Occurrences
Dim oName(10) As String
oCount = 0
For Each oOcc In oOccs
If oCount = 2 Then
Exit For
Else
i = 0
Dim oDC As Document
Set oDC = oOcc.Definition.Document
Debug.Print oDC.ComponentDefinition.WorkPoints.count
For Each wp In oDC.ComponentDefinition.WorkPoints
If wp.Name = "LVCL" Or wp.Name = "HVCL" Or wp.Name = "CCL" Or wp.Name = "CCR" Then
Debug.Print wp.Name
oName(i) = wp.Name
i = i + 1
End If
Next
Call ProxyCL(oName(0), oName(1), oOcc, oSheet, oView)
oCount = oCount + 1
End If
Next
End Sub
--------------------------------------------------
Public Function ProxyCL(oName1 As String, oName2 As String, oOcc1 As ComponentOccurrence, oSheet As Sheet, oView As DrawingView)
Dim oDocDef As Document
Set oDocDef = oOcc1.Definition.Document
'Dim oAssDoc As AssemblyDocument
'Set oAssDoc = Oview.ReferencedDocumentDescriptor.ReferencedDocument
Set WP1 = oDocDef.ComponentDefinition.WorkPoints.Item(oName1)
Set WP2 = oDocDef.ComponentDefinition.WorkPoints.Item(oName2)
Dim wpProxy1 As WorkPointProxy
Dim wpProxy2 As WorkPointProxy
Call oOcc1.CreateGeometryProxy(WP1, wpProxy1)
Call oOcc1.CreateGeometryProxy(WP2, wpProxy2)
Dim oCM1 As Centermark
Set oCM1 = oSheet.Centermarks.AddByWorkFeature(wpProxy1, oView)
Dim oCM2 As Centermark
Set oCM2 = oSheet.Centermarks.AddByWorkFeature(wpProxy2, oView)
oCM1.Visible = False
oCM2.Visible = False
Dim oLeaderPoint As ObjectCollection
Set oLeaderPoint = ThisApplication.TransientObjects.CreateObjectCollection
Call oLeaderPoint.Add(oCM1)
Call oLeaderPoint.Add(oCM2)
Dim oPosition As Point2d
set oPosition = oSheet.
Dim CL As Centerline
Set CL = oSheet.CENTERLINES.Add(oLeaderPoint)
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim SK As SketchedSymbolDefinition
Set SK = oDoc.SketchedSymbolDefinitions.Item("TANK CL")
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oSketchedSymbol As SketchedSymbol
Set oSketchedSymbol = oSheet.SketchedSymbols.Add(SK, oPosition, , 1)
End Function
Solved! Go to Solution.