We have a iLogic Rule that measures extents (length, width + thickness) and for some reason it measures work planes instead of just the model. We have been resizing them until they are no longer sticking out but we don't always rememeber.
Any way to stop this from calculating?
Imports System.Collections.Generic ' Make List(of T) type available InventorVb.DocumentUpdate() Dim sizes As New List(Of Double) sizes.Add(Measure.ExtentsLength) sizes.Add(Measure.ExtentsWidth) sizes.Add(Measure.ExtentsHeight) sizes.Sort() Parameter("LENGTH") = sizes(2) Parameter("WIDTH") = sizes(1) Parameter("THICKNESS") = sizes(0) iLogicVb.UpdateWhenDone = True
Pretty simple 😉
Imports System.Collections.Generic
'Turn off work features so they dont calculate
ThisDoc.Document.ObjectVisibility.AllWorkFeatures = False
'Make List(of T) type available
InventorVb.DocumentUpdate()
Dim sizes As New List(Of Double)
sizes.Add(Measure.ExtentsLength)
sizes.Add(Measure.ExtentsWidth)
sizes.Add(Measure.ExtentsHeight)
sizes.Sort()
Parameter("LENGTH") = sizes(2)
Parameter("WIDTH") = sizes(1)
Parameter("THICKNESS") = sizes(0)
iLogicVb.UpdateWhenDone = True
'Turn back on work features - optional
ThisDoc.Document.ObjectVisibility.AllWorkFeatures = True
Gettting this
Public member 'ObjectVisibility' on type 'PartDocument' not found.
it's always done this weither they were on or off
As soon as you turn off the workplane it doesn't calculate it, that's how extents works - it has to be enabled.
Here, try this workaround
Imports System.Collections.Generic 'Make List(of T) type available Dim oApp As Application oApp = ThisApplication Dim oPart As PartDocument oPart = oApp.ActiveDocument 'Turn off work features so they dont calculate oPart.ObjectVisibility.AllWorkFeatures = False InventorVb.DocumentUpdate() Dim sizes As New List(Of Double) sizes.Add(Measure.ExtentsLength) sizes.Add(Measure.ExtentsWidth) sizes.Add(Measure.ExtentsHeight) sizes.Sort() Parameter("LENGTH") = sizes(2) Parameter("WIDTH") = sizes(1) Parameter("THICKNESS") = sizes(0) iLogicVb.UpdateWhenDone = True 'Turn back on work features - optional oPart.ObjectVisibility.AllWorkFeatures = True
Negative jd
Still says Public member 'ObjectVisibility' on type 'PartDocument' not found.
I tried my original rule and it did work when i manualy turned off all work features.
Thanks for clarifing that
Ok, so it must be that 2010 doesnt support that through iLogic. I would find another method in VBA, because it's too easy for someone to turn it back on and mess up your extents. Whereas a script would always make sure it was turned off first before calculating. I'll keep looking for you.