How to place stamp/symbol automatically at bottom righthand corner of drawing border?

How to place stamp/symbol automatically at bottom righthand corner of drawing border?

Jason.Rugg
Collaborator Collaborator
501 Views
6 Replies
Message 1 of 7

How to place stamp/symbol automatically at bottom righthand corner of drawing border?

Jason.Rugg
Collaborator
Collaborator

I have a symbol/stamp that is being inserted onto drawings when releasing them. The stamp gets placed on the right hand border of the drawing but this only works for a certain drawing template since it is using a 0,0 insertion point (which is the bottom left hand corner of the drawing sheet. To allow this to work with different drawing templates/sizes I need the code to be able to detect the bottom right hand corner of the drawing sheet automatically and use that point as the insertion point for the stamp, is that possible? Below is the portion of my code how it is currently working.

 

Option Explicit On
Imports System.IO
Sub Main
	Call PlaceStamp()
	Call CreatePDF()
	'Call Printing()
	Call Email()
	Call DeleteStamp()
	
End Sub

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

Sub DeleteStamp


 

0 Likes
502 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor
Use "border maxpoint x" and "border minpunt y" to find the coördinaten!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 3 of 7

Jason.Rugg
Collaborator
Collaborator

@bradeneuropeArthur Sounds good but I am unfamiliar with how to that.

0 Likes
Message 4 of 7

WCrihfield
Mentor
Mentor
Dim oBorder As Border = ThisDrawing.Document.ActiveSheet.Border
oX = oBorder.RangeBox.MaxPoint.X
oY = oBorder.RangeBox.MinPoint.Y
oPosition = ThisApplication.TransientGeometry.CreatePoint2d(oX, oY)

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 7

Jason.Rugg
Collaborator
Collaborator

@WCrihfield If I place that bit of code in a rule with the code that places the stamp it seems to work as expected (as shown below). Bigger code shown further down with errors.

 

Working Rule

Sub Main
	' reference to the sketched symbol definition.
	
	Dim oBorder As Border = ThisDrawing.Document.ActiveSheet.Border
    oX = oBorder.RangeBox.MaxPoint.X
	oY = oBorder.RangeBox.MinPoint.Y
	oPosition = ThisApplication.TransientGeometry.CreatePoint2d(oX, oY)
	
	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(oX, oY)

	' 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

 

Bigger Code not working with errors, not sure what the difference is and why it is not working in the bigger picture.2022-12-05 13_28_37-Edit Rule_ Drawing Release.png

Option Explicit On
Imports System.IO
End Function

Sub PlaceStamp
	' reference to the sketched symbol definition.
	
	Dim oBorder As Border = ThisDrawing.Document.ActiveSheet.Border
    oX = oBorder.RangeBox.MaxPoint.X
	oY = oBorder.RangeBox.MinPoint.Y
	oPosition = ThisApplication.TransientGeometry.CreatePoint2d(oX, oY)
	
	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(oX, oY)

	' 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

Sub DeleteStamp


 

0 Likes
Message 6 of 7

WCrihfield
Mentor
Mentor

I should have 'declared' the variables I was using there to avoid 'strict' setting warnings, and used your "oPoint" variable line of code, instead of using a different variable name for that Point2d object it was creating, because you are still using the oPoint variable in your 'SketchedSymbols.Add()' method, instead of the new oPosition variable.  Here is how that last Sub should have been updated:

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 oBorder As Border = oSheet.Border 'can be Nothing, good to check first
    Dim oX As Double = oBorder.RangeBox.MaxPoint.X
	Dim oY As Double = oBorder.RangeBox.MinPoint.Y
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim oPoint As Point2d = oTG.CreatePoint2d(oX, oY)

	' 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

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 7

bradeneuropeArthur
Mentor
Mentor
' reference to the sketched symbol definition.
	
	Dim oBorder As Border = ThisDrawing.Document.ActiveSheet.Border
    oX = oBorder.RangeBox.MaxPoint.X
	oY = oBorder.RangeBox.MinPoint.Y
	oPosition = ThisApplication.TransientGeometry.CreatePoint2d(oX, oY)
	
	'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(oX, oY)

	' 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.Item(1)
	oSymbol.Position= oPoint

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes