Message 1 of 19

Not applicable
02-17-2016
09:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Possibly.. can you be more specific?
Sure. I'm designing a title block that spans an entire sheet height within defined borders, with a consistent width.
I want the titleblock to remain the same width for both ANSI D and Arch D (Easy!), but I want the height of the "empty space" to change by some delta according to the (sheet height - the border gap on both sides). (the not so easy part)
I want to determine what the sheet size is based on an iLogic parameter, and pass that data into some dimension parameter within the title block definition, so I can adjust the size of two lines relative to the maximum sheet height and the borders.
I'm not sure.. Don't think so as title block definitions don't support parameters for dimensions..
I would just use 2 title blocks and call it a day..
I think it does because you can set dimension parameter values to others within the titleblock. When you edit a dimension, you can totally use "=d3", for example.
@mcgyvr wrote:I'm not sure.. Don't think so as title block definitions don't support parameters for dimensions..
I would just use 2 title blocks and call it a day..
I think it does because you can set dimension parameter values to others within the titleblock. When you edit a dimension, you can totally use "=d3", for example.
@Anonymous wrote:
@mcgyvr wrote:
I'm not sure.. Don't think so as title block definitions don't support parameters for dimensions..
I would just use 2 title blocks and call it a day..
I think it does because you can set dimension parameter values to others within the titleblock. When you edit a dimension, you can totally use "=d3", for example.
I meant user or named parameters..
Yes you can do = d3 but you can't do "BlockWidth=1" like you can do in regular Inventor files..
I would still use 2 title blocks and call it done (I'm sure you have spent far more time investigating this than if you were to just make the second block and call it a day).. I personally see no point in writing custom code to handle something that more than likely will never be modified again.. Once you have your title blocks set up there is a very slim chance they will be modified again..
Sure it can happen in certain cases but tackle that when/if it ever happens...
HI RobertWK,
This can be done using the API TitleBlockDefinition.Sketch property, attached is a quick working example created with Inventor 2015.
Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oTitleBlockDef As TitleBlockDefinition oTitleBlockDef = oDrawDoc.TitleBlockDefinitions.Item(1) Dim oSketch As DrawingSketch oTitleBlockDef.Edit(oSketch) Dim oDim As DimensionConstraint For Each oDim In oSketch.DimensionConstraints If oDim.Parameter.Name = "d1" Then 'toggle the dimension value ( in inches) If oDim.Parameter.Value = 2 * 2.54 Then oDim.Parameter.Value = 3 * 2.54 Else oDim.Parameter.Value = 2 * 2.54 End If End If Next oTitleBlockDef.ExitEdit(True)
@Curtis_Waguespack wrote:HI RobertWK,
This can be done using the API TitleBlockDefinition.Sketch property, attached is a quick working example created with Inventor 2015.
... (code) ...
Does there have to be a rule, trigger that fires this?
Hi RobertWK,
I would use a form to change the sheet size and trigger the rule. See the attached example file (Inventor 2015).
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
If SheetSizeList = "D Arch" Then ActiveSheet.ChangeSize("24 x 36 (inches)", MoveBorderItems := True) ElseIf SheetSizeList = "D ANSI" Then ActiveSheet.ChangeSize("D", MoveBorderItems := True) ElseIf SheetSizeList = "C Size" Then ActiveSheet.ChangeSize("C", MoveBorderItems := True) ElseIf SheetSizeList = "B Size" Then ActiveSheet.ChangeSize("B", MoveBorderItems := True) ElseIf SheetSizeList = "A Size" Then ActiveSheet.ChangeSize("A", MoveBorderItems := True) End If ''use this line to report SheetSizeList for testing 'InputBox("Sheet Size Is:", "iLogic",SheetSizeList ) ''use this line to report ActiveSheet.Size for testing 'InputBox("Sheet Size Is:", "iLogic",ActiveSheet.Size ) Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oTitleBlockDef As TitleBlockDefinition oTitleBlockDef = oDrawDoc.TitleBlockDefinitions.Item(1) Dim oSketch As DrawingSketch oTitleBlockDef.Edit(oSketch) Dim oDim As DimensionConstraint oValue = ActiveSheet.Height - (0.125 in * 2) 'where 0.125 in = the border margin For Each oDim In oSketch.DimensionConstraints If oDim.Parameter.Name = "d0" Then oDim.Parameter.Value = oValue * 2.54 '2.54 coverts the value to inches End If Next oTitleBlockDef.ExitEdit(True) 'zoom all ThisApplication.ActiveView.Fit
Curtis,
You are amazing!
I put together this bit, but it seems to be causing a warning:
Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oTitleBlockDef As TitleBlockDefinition oTitleBlockDef = oDrawDoc.TitleBlockDefinitions.Item(1) Dim oSketch As DrawingSketch oTitleBlockDef.Edit(oSketch) Dim oDim As DimensionConstraint If ActiveSheet.Height = 11 And oTitleBlockDef = "A-B" Then oDim.Parameter.Value("d0") = (8.5 - .25 - .25 - .75 - (.25*5)) Else If ActiveSheet.Height = 17 And oTitleBlockDef = "A-B" Then oDim.Parameter.Value("d0") = (11 - .25 - .25 - .75 - (.25 * 5)) End If oTitleBlockDef.ExitEdit(True)
Error in rule: INSERT_BLOCK, in document: title_development.idw
Unable to cast COM object of type 'System.__ComObject' to class type 'System.String'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Where can I find documentation about objects and functions for the Inventor iLogic api/sdk?
Hi RobertWK,
Does your title block have prompted entries in it?
API reference info:
http://inventortrenches.blogspot.com/2013/10/ilogic-how-to-learn-inventors.html
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Not yet, but it will, eventually.
Hi RobertWK,
A couple of things. My earlier examples found the titleblock by Item number (ex: DrawDoc.TitleBlockDefinitions.Item(1), but if you intend to call it by name, you can just set the oTitleBlockDef to do so as in the example below.
Unfortunately, it doesn't appear that you can do the same for the dimension (unless I missed it), so I've used an For Each to find "d0"
Also, the ActiveSheet.Height comes in as Inches (it's an iLogic call) , but the Parameter Value (Inventor API call) uses Inventor's internal units of cm's so a conversion is needed.
And lastly, I tested this with a prompted entry in the title block and it doesn't seem to cause an issue, so you can ignore that question from earlier.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oTitleBlockDef As TitleBlockDefinition oTitleBlockDef = oDrawDoc.TitleBlockDefinitions.Item("A-B") Dim oSketch As DrawingSketch oTitleBlockDef.Edit(oSketch) Dim oDim As DimensionConstraint 'find d0 For Each oDim In oSketch.DimensionConstraints If oDim.Parameter.Name = "d0" Then Exit For End If Next If ActiveSheet.Height = 11 Then oDim.Parameter.Value = (8.5 - 0.25 - 0.25 - 0.75 - (0.25*5)) * 2.54 Else If ActiveSheet.Height = 17 Then oDim.Parameter.Value = (11 - 0.25 - 0.25 - 0.75 - (0.25 * 5)) * 2.54 End If oTitleBlockDef.ExitEdit(True)
Thanks a ton 🙂
This has been an immeasurable amount of help.
Nevermind. Fixed it with Case.
Curtis,
The for loop to find the dimension of 'd0' is failing to run all the time, probably because of an indexing problem or some kind of return value. I have to run the rule multiple times for it to 'fire'.
Is there a way to directly address the 'd0' dimension without having to find it?
Hi RobertWK,
If you know that it is always going to be d0 (i.e. the first dimension in the sketch) then I think you can just use:
oDim = oSketch.DimensionConstraints.Item(1)
As this will designate the first dimension constraint / parameter as oDim
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com