Here is a start point for inserting a symbol and checking sheet orientation and size in order to position symbol.
The symbol in this example is taken from the symbol library and added to the drawing. If you want to take the symbol from the drawing just switch the source from symbol library to Drawing. You will need to adjust the position of the symbol so if you have questions on that just post them here. It should be straight forward enough so test and modify oPosition.x & oPosition.y as needed.
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oSymbol As SketchedSymbol
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
'This is the initial position for the sketched symbol'
Dim oPosition As Point2d = oTG.CreatePoint2d(0, 0)
'This checks the sheet for sketched symbol.
For Each oSymbol In oSheet.SketchedSymbols
If oSymbol.Name = "Signature" Then
Else
'[Get Symbol from symbol Library
Dim oSketchSymLib As SketchedSymbolDefinitionLibrary _
= oDrawDoc.SketchedSymbolDefinitions.SketchedSymbolDefinitionLibraries.Item("Library")
Dim oSymDef As SketchedSymbolDefinition _
= oDrawDoc.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "Signature", True)
']
'Get Symbol from local drawing
'Dim oSymDef As SketchedSymbolDefinition = oDrawDoc.SketchedSymbolDefinitions.Item(“Signature")
'This inserts the sketched symbol and fills in the prompted entry.
oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition)
End If
Next
'Position Symbol
If oSheet.Orientation= PageOrientationTypeEnum.kLandscapePageOrientation AndAlso oSheet.Size = DrawingSheetSizeEnum.kA4DrawingSheetSize Then
oPosition.X = oPosition.X + oSheet.Border.RangeBox.MaxPoint.X
oPosition.Y = oPosition.Y + 2
oSymbol.Position = oTG.CreatePoint2d(oPosition.X, oPosition.Y)
MessageBox.Show("Orientation: " & oSheet.Orientation.ToString & vbLf & "Size: " & oSheet.Size.ToString, "Title")
ElseIf oSheet.Orientation = PageOrientationTypeEnum.kPortraitPageOrientation AndAlso oSheet.Size = DrawingSheetSizeEnum.kA4DrawingSheetSize
oPosition.X = oPosition.X + oSheet.Border.RangeBox.MaxPoint.X
oPosition.Y = oPosition.Y + 2
oSymbol.Position = oTG.CreatePoint2d(oPosition.X, oPosition.Y)
MessageBox.Show("Orientation: " & oSheet.Orientation.ToString & vbLf & "Size: " & oSheet.Size.ToString, "Title")
End If
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan