Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dears,
I'm using this code to insert a sketch symbol from Library/Template file to working drawing. Please help me to check and give me another solution?
Dim oDOC As Inventor.DrawingDocument = _InventorApp.ActiveDocument
Dim oSSDefs As SketchedSymbolDefinitions = oDOC.SketchedSymbolDefinitions
Dim oLibrary As SketchedSymbolDefinitionLibrary = oSSDefs.SketchedSymbolDefinitionLibraries.Item("SketchSymbols.idw")
Dim wSSDef As SketchedSymbolDefinition = Nothing
Try
wSSDef = oDOC.SketchedSymbolDefinitions.Item("ABC")
Catch ex As Exception
wSSDef = oSSDefs.AddFromLibrary(oLibrary, "ABC", True)
End Try
For Each ChkObject As Object In oDOC.SelectSet
If ChkObject.Type() = ObjectTypeEnum.kLinearGeneralDimensionObject Then
Dim wPoint As Inventor.Point2d = ChkObject.DimensionLine.MidPoint
Dim wSketchSymbol As SketchedSymbol = oDOC.ActiveSheet.SketchedSymbols.Add(wSSDef, wPoint, 0, 1, Nothing)
wSketchSymbol.Static() = True
End If
Next
My issue is: If SketchSymbol existed, it'll be insert corrected at the first time. If SketchSymbol doesn't existed, the SketchSymbol 'll copy to current drawing only and doesn't used at the first time - It'll insert at the second time when code run again!
I don't know why. Could you please help me. Thanks!
Solved! Go to Solution.