Hi CadUser46,
This will toggle all of the sketch dims in the part to dislay the equation:
ThisApplication.CommandManager.ControlDefinitions.Item("DimensionDisplayEqn").Execute
or you could use something such as this to toggle between Value and Expression:
kDimensionDisplayAsValue = 34817 kDimensionDisplayAsName = 34818 kDimensionDisplayAsExpression = 34819 kDimensionDisplayAsTolerance = 34820 kDimensionDisplayAsPreciseValue = 34821 Dim oDoc As Inventor.PartDocument oDoc = ThisApplication.ActiveDocument Dim oParams As Parameters oParams = oDoc.ComponentDefinition.Parameters Dim oModelParams As ModelParameters oModelParams = oParams.ModelParameters If oParams.DimensionDisplayType = kDimensionDisplayAsValue then oParams.DimensionDisplayType = kDimensionDisplayAsExpression else oParams.DimensionDisplayType = kDimensionDisplayAsValue end if
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Thanks Curtis i will have a play with that at some point. I take it this means there is no way to show the expression in the parameters then? Kind of like writing the expression to the parameters rather than computing the value?
Hi CadUser46,
Sorry I misunderstood what you were after. Actually, I think there is a way to do that, but I can't recall where the setting is off the top of my head. Unfortunatly, I just tied my computer/Inventor up for a long task, so someone else might jump in here and point you to it. I'll try and look it up in the mean time.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi CadUser46,
Okay, I think this is what you're after. Below is a snippet that toggles this setting between Value and Expression.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oDoc As Inventor.PartDocument oDoc = ThisApplication.ActiveDocument Dim oParams As Parameters oParams = oDoc.ComponentDefinition.Parameters Dim oModelParams As ModelParameters oModelParams = oParams.ModelParameters If oParams.DisplayParameterAsExpression = True then oParams.DisplayParameterAsExpression = False Else if DisplayParameterAsExpression = False Then oParams.DisplayParameterAsExpression = True end if
Hi Curtis. Its close but still not what i was after. I have screen printed what im after.
Thanks
You have to maintain the equation as a text string in the rule. Here's a sample:
trigger = Thickness
Parameter("d5") = "Thickness / 2"
The trigger line is required to make sure the rule will run when the value of Thickness is changed. If you are using Thickness elsewhere in the same rule (not in a text string, but as a variable that shows up in blue) then you don't need the trigger line.
Cheers Mike. I did try something like that but i was using the wrong notation. I will adjust tomorrow.
Thanks.
OK so got around to trying this today. It works as long as the parameter has its default value. If it has been renamed it does not work and i just get an error.
If i write something like this i get an error;
Parameter("InnerRad") = "THICKNESS"
Parameter(InnerRad) = "THICKNESS"
If i write something like this iit works fine;
Parameter("d5") = "THICKNESS"
If i rename i parameter back to its default after having already changed the name it no longer works either.
I'm not sure what is causing the problem. Can you post another screenshot of your Parameters dialog, showing both parameters? Or can you post the part or assembly?
Hi Mike
I have attached a file. You will see from the ilogic the parameters InnerRad and OuterRad which should be written as expressions in both of the rules.
Here's a version of your part with the rules edited to set the Equations for InnerRad and OuterRad with statements like this:
Parameter("InnerRad") = "Thickness * 1.5 ul"
Note that when you use statements like that, with parameter names in text strings, the parameter names will not automatically change in the rule if you rename the parameter in the part. You have to edit the rule and do a Search and Replace to replace the old parameter name with the new one.
Mike. Thanks for the help. I have it working now but could have sworn blind i already used that exact syntax.
I understand the ilogic would not change automatically but i wonder if it makes a difference if i simply typed in the text window rather than double clicking to insert the model paramter.
Thanks again.