Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Title block placeholders for dimensions that don't exist yet.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
awelton00
137 Views, 2 Replies

Title block placeholders for dimensions that don't exist yet.

I'm trying to automate out some tedium and I've hit a snag. I have some ilogic code that grabs an aligned minimum bounding box for a part and stores the dimensions into custom properties. What I need to do now is make those dimensions automatically populate in a section of a title block template. Since I can't put placeholders in the title block template for custom properties that don't exist yet, I feel like I'm trying to go about it backwards. The only way I have figured out how to accomplish it is to use some unused standard properties from the part (i.e. part numbers or revision) as my placeholders in the title block so later when I make the part and run the bounding block script I can feed the output into those fields to fill in the title block when I make a drawing from the part.

There has got to be a better way to go about this, I just don't understand it enough yet to see the correct path forward. If someone could give me some high level steps to read up on for how to have an 'empty' property in the title block that I can populate with data pulled from the model at a later date it would help me tremendously.  I'm trying to read documentation and piece it together as I go, but I have no programming experience so it's like drinking from a fire hose.

Of course if someone has the time to lead me all the way through the process so I can understand the core concepts little better in the future it would be greatly appreciated as well. This is feeling an awful lot like an XY problem. 

2 REPLIES 2
Message 2 of 3
A.Acheson
in reply to: awelton00

Can you manually put the model in the template and create the custom iproperties in the title block then delete the model? I can't remember if that would work. 

 

With ilogic here is the on the fly method using formatted text. You basically pick up the text that contains the link that would pull information from the model into what ever text object you needed, be it general note, view label etc. In the below simply place a custom iproperty rather than the parameter. Retrieve the formatted text then hard code it into whatever object you need.

 

Here is the snippet "oGeneralNote.FormattedText" that would retrieve the formatted text from a general note.

The rule below functions by retrieving the formatted text from the first general note placed on the drawing with manually placed linked parameter "G_L". Then uses that in General Note 2 added. 

Hopefully this will be of help to your questions. 

 

Sub Main()

    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument

    Dim oActiveSheet As Sheet
    oActiveSheet = oDrawDoc.ActiveSheet
    
 
    Dim oGeneralNotes As GeneralNotes
    oGeneralNotes = oActiveSheet.DrawingNotes.GeneralNotes
    
	Call GetFormattedText(oGeneralNotes)
	
    Dim oTG As TransientGeometry
    oTG = ThisApplication.TransientGeometry


    Dim sText As String
	Dim Note1 As String
	Dim Note2 As String
	Dim Note3 As String
	Dim Note4 As String
	Dim Note5 As String
	Dim Note6 As String
	
	sText = "<StyleOverride Italic = 'True' Underline = 'True'>NOTES:</StyleOverride><Br/> <Br/>"
	Note1 = "1...<Br/> <Br/>"
	Note2 = "2...<Br/> <Br/>"
	Note3 = "3..." & sFormattedText
	Note4 = ""
	Note5 = ""
	Note6 = ""	
    
    Dim oGeneralNote As GeneralNote
    oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(3, 6.75), sText  & Note1 & Note2 & Note3 & Note4 & Note5 & Note6)
	oGeneralNote.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextLower
	oGeneralNote.Width = 30

End Sub
Dim sFormattedText As String
Sub GetFormattedText(oGeneralNotes)
	 Dim oGeneralNote As GeneralNote = oGeneralNotes(1)
	sFormattedText = InputBox("","FormattedText",oGeneralNote.FormattedText)
End Sub
If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 3
awelton00
in reply to: A.Acheson

Putting a model view in the drawing template, editing the title block to include the custom iproperties, and then deleting the view did indeed work perfectly. 

Your snippet gives me some ideas for some other things I would like to try as well. Thank you very much.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report