Measure Dimensions in a derived part.

Measure Dimensions in a derived part.

Anonymous
Not applicable
1,335 Views
4 Replies
Message 1 of 5

Measure Dimensions in a derived part.

Anonymous
Not applicable

I´m trying to measure the base dimensions of simple geometric shapes. I started out with plates since they are easy to measure as long as they sit in 90°, 180° and 270° positions relative to the origin. Then Measure.ExtentsLength, Measure.ExtentsWidth and Measure.ExtentsHeight will give me the base dimensions of a plate.


However, if the plate sits abitrary relative to origin this will obviously fail, since Measure.Extents only measures in x,y,z

Is there any way how I get positions of the geometry that is in the part, like corners surfaces on the B-REP so I can calculate the dimensions properly for a plate. I´m not sure if this is possible with iLogic. I have a strong suspicion VB.net would be needed for this.

Another problem I have is that derived parts don´t get triggered to run a script when I change the geometry in the Multibody Part and the rule is set to run by any modelgeometry change. Need help on that.

 

Best regards

 

Falk

 

0 Likes
1,336 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

 

I´m still having some problems with triggering my rules on specific events. I have saved my code in a template and it runs on creating a new document. That works as intended when I derive selected parts from a Multibody Part.

However, it doesn´t run when I change Model Geometry in the MBP and update the derived assembly, I have also enabled that trigger for getting the changes on the Multibody Part.

I have an additional rule in the template that get´s triggered by change of property (material for example) which works flawlessly.

Is there something I´m missing in my iLogic script for getting the geometry update into my parameters?

 

thanks in advance

0 Likes
Message 3 of 5

Vladimir.Ananyev
Alumni
Alumni

Is it acceptable to measure the extents of your plate as a distances between predefined named workpoints / workplanes?  If yes, then situation become much more simple.  You may use marvelous Measure.MinimumDistance method to calculate the distance between two workpoints, workpoint and workplane, etc.

dx = Measure.MinimumDistance("WorkPoint_Origin", "WorkPointAlongX")

dy = Measure.MinimumDistance("WorkPoint_Origin", "WorkPointAlongY")

dz = Measure.MinimumDistance("WorkPoint_Origin", "WorkPointAlongZ")

These values doesn’t depend on the plate orientation relative to its coordinate system.

 

In any case you need in information on the local coordinate system of a plate. Either you have predefined UserCoordinateSystem, or able to create it on the fly programmatically  -  you must retrieve orientation data fom your plate.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 4 of 5

Anonymous
Not applicable

Does that mean the user would have to define the workpoints and workplanes to make that work?

 

I´ve already achieved getting the Length, Width and Height with Measure.Extents and write them in some Parameters.

Right now I´m struggling with the derived component not running the rule when I update the assembly while I´ve edited the MBP for one of the components.

What I want is that the rule for measuring the dimensions is running again when I change Length, Width and Height in the MBP. Then I update the derived assembly but the rule for measuring the Length, Width and Height doesn´t run again. I´ve selected the trigger to be updating on iproperty change, Geometry Change, Material Change and any Model Parameter change.

Still no go. Only when I change the material in the BOM it kinda works.

 

Cheers

 

0 Likes
Message 5 of 5

Vladimir.Ananyev
Alumni
Alumni

Hi Falk 

I have an idea that IMHO is worth to be tested on your side. I've tested it on my simple test model. 

Description

1) Master part (skeleton) includes two solid bodies — bar and cylinder.  This master part was used as MBP to create the assembly with two components (bar and cylinder). 

2) Each of this components derives necessary model parameters from master part.  These parameters works as triggers for local iLogic rules that perform any needed calculations (e.g., measure dimensions). 

3) Top assembly document has no derived parameters but has iLogic rule that updates entire assembly.  

4) Master part has the rule “Sensor” that is triggered by the combination of all control parameters. This rule initiates the update rule in the top assembly. 

 

Open assembly and master part.

Then open the form in master part and change any control parameter (e.g., Length).

Local rule “Sensor” automatically finds and run update rule in the top assembly.

All components are updated and those that are driven by changes in control parameters run their local update rules.  Rules are initiated by derived parameters. We may see this due to message boxes.  Local rules in components can measure required dimensions. 

Form.png 

Result:  all components and top assembly are updated “automatically” performing required calculations. 

Sample assembly is attached (Inventor 2013).

 

 

Master part (skeleton)

Has several control parameters Length, Width, Height, Radius.

 Master part - model.png

 Master part - parameters.png

 

 

Rule in the MasterPart.ipt

Rule is initiated by changes of values of blue parameters.

Rule finds in memory the document with the name “ASSY.iam” and run all its rules (here I have only one rule that updates assembly).  

x = Width+Height+Radius+Length  'trigger

Dim MainAssyName As String = "ASSY.iam"
Dim Found As Boolean = Fasle
For Each oDoc as Inventor.Document In ThisApplication.documents
  If oDoc.DisplayName  = MainAssyName Then
    Found = True
    Dim iLogicAuto As Object = iLogicVb.Automation       
    Dim rules As Object = iLogicAuto.rules(oDoc)             
    If (rules IsNot Nothing) Then
      For Each rule  As Object In rules
'       iLogicAuto.RunRule(oDoc, rule.Name) ' this also works
        iLogicAuto.RunRuledirect(rule)     
      Next
    End If
  End If
Next
If Not Found Then
   MessageBox.Show("Assembly  " & MainAssyName & "  not found",
     "TEST", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

 

----------------------------------------------------------------- 

Rule “SensorASSY” in ASSY.iam

Updates entire top assembly. Driven by rule in MasterPart.ipt. 

Message box is used as process indicator only and may be removed. 

InventorVb.DocumentUpdate()
Beep
MsgBox("Assy was updates")

 -----------------------------------------------------------------

Rule in Cylinder.ipt

Run when at least one “blue” parameter is changed. 

Message box is used as process indicator only and may be removed. 

x=Length+Radius
Beep
MsgBox("Rule in CYLINDER")

 ----------------------------------------------------------------- 

Rule in Bar.ipt

Run when at least one “blue” parameter is changed. 

Message box is used as process indicator only and may be removed. 

x=Width+Height+Length 
Beep
MsgBox("Rule in BAR") 

 -----------------------------------------------------------------

Please let me know if this control method works for you.

Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes