- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to add more functionality to one of my iLogic parts. The main portion of the iLogic code and associated form have been working quite well so far. This is what I am trying to accomplish at this time:
The part in question (see attached ipt file with embedded rule and form) is a go/no-go pin used in check fixtures. It has an unconsumed planar sketch in which I have parameter based text that shows the hole designation and nominal hole size, which I turn on in the top view of the check fixture. I found this easier to use than adding or updating leader text, as it tends to stay where it is supposed to, and is fairly automatic.
Now I am trying to make this a full blown ilogic driven part so I can just place it as an ilogic component instance. One of the items I have to accomplish in the rule is to adjust the textbox vertical justification to either the top or bottom. I have written the ilogic code to do this, and it is mostly working, but I am having the following problem:
1. The rule first runs my ilogic form. I've added a True/False parameter for setting the text justification.
2. The actual jsutification does not update the first time I run the rule. But if I run the rule again and just dismiss the form, the justification does change. (so I basically have to run the rule twice for it to work)
3. The really weird thing is, if I just invoke the form and switch the justification, it updates right away, without running the rule that changes it. But if I comment out the relevant code in the rule, just running the form has no effect? It's like the form is invoking the rule?
Here is the text from the rule:
iLogicForm.Show("GNG RND PIN", FormMode.Modal)
'start of newest text justification code: 'get the reference to the text box Dim oPartDef As PartComponentDefinition Dim oPartDoc As PartDocument oPartDoc = ThisDoc.Document oPartDef = oPartDoc.ComponentDefinition Dim oSketches As PlanarSketches oSketches = oPartDef.Sketches Dim oSketch As PlanarSketch oSketch = oSketches.Item("DRAWING_LABEL") Dim oTextBox As TextBox oTextBox = oSketch.TextBoxes.Item(1)
If TEXT_ABOVE = True Then oTextBox.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextUpper Else oTextBox.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextLower End If
'end of newest code for text justification.
InventorVb.DocumentUpdate() Dim value1 As Double = Parameter("GO") Dim value2 As Double = Parameter("NOGO") InventorVb.DocumentUpdate() iProperties.Value("Project", "Part Number") = "GNG RND PIN, HOLE " & CStr(Parameter("HOLE_DESIGNATION")) & ", " & value1.ToString("#0.000") & "-" & value2.ToString("#0.000")
I am using Inventor Pro 2015 SP2 Update 1 (thought I had Update 2, but looks like I only downloaded it, might have to try that)
Can someone check this out and tell me how to fix it so the justification updates the first time the rule is run? I appreicate it! Thanks!
Solved! Go to Solution.