Sketch Symbol Placement via iLogic

Sketch Symbol Placement via iLogic

Jason.Rugg
Collaborator Collaborator
180 Views
1 Reply
Message 1 of 2

Sketch Symbol Placement via iLogic

Jason.Rugg
Collaborator
Collaborator

I have the following code that places a symbol onto drawings, this code is within a larger code that does other things as well. Currently the symbol is placed off of 0,0 but because we use different templates this placement doesn't work for all drawings. Is there a way to detect the bottom right hand corner of the sheet and place the symbol a set distance off of that corner?

 

Sub PlaceStamp
	' reference to the sketched symbol definition.
	Dim oSymbolDef As SketchedSymbolDefinition
	oSymbolDef = ThisDrawing.Document.SketchedSymbolDefinitions.Item("Drawing Release Stamp")

	Dim oSheet As Sheet = ThisDrawing.Document.ActiveSheet

	'create insertion point, coordinates - in cm !
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim oPoint As Point2d = oTG.CreatePoint2d(0, 0)

	' Add an instance of the sketched symbol definition to the sheet.
	' Rotate angle = 0 radians,  scale = 1 when adding

	Dim sPromptStrings(4) As String
	'get prompt values, this example just uses hardcoded values
	sPromptStrings(0) = InputBox("Enter Signature", "iLogic", "")
	sPromptStrings(1) = InputBox("Enter Date", "iLogic", "")
	sPromptStrings(2) = InputBox("Enter Job #", "iLogic", "")
	sPromptStrings(3) = InputBox("Enter Rev", "iLogic", "")
	sPromptStrings(4) = InputBox("If this is a revised drawing, type 'REVISED DRAWING'", "iLogic", "")

	Dim oSymbol As SketchedSymbol 
	oSymbol = oSheet.SketchedSymbols.Add(oSymbolDef, oPoint, 0, 1, sPromptStrings)
	
End Sub
0 Likes
181 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

You can detect the sheet border and retrieve a point from there. This help sample for partslist does a similar thing.

Here is the property for Border.Rangebox in the help file

 

Dim oBorder As Border = oSheet.Border
Dim PointX as Double = oBorder.RangeBox.MinPoint.X
Dim PointY as Double = oBorder.RangeBox.MinPoint.Y

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes