LxBxH Dimension auto update after Saving

LxBxH Dimension auto update after Saving

ganesh_omkaar
Contributor Contributor
338 Views
2 Replies
Message 1 of 3

LxBxH Dimension auto update after Saving

ganesh_omkaar
Contributor
Contributor

Dear all,

I need help, for LxBxH Dimension for partlist,  auto update after  Saving file.

currently i am using i logic code 

i need to run code every time .

also using run rule in child part but some time it get miss, then required dimension not get update.  

event trigger take lot time for saving 

 

if i make something so my dimension update after save , i will save lot of time 

but i dont idea how to make it 

 

 

My i logic Code 

' Get the current Part document.
Dim partDoc As PartDocument = ThisDoc.Document
' Get surface body to measure (assume it's the first body).
Dim body1 As SurfaceBody = partDoc.ComponentDefinition.SurfaceBodies.Item(1)

' Get the oriented mininum range box of the body.
' NOTE: "OrientedMinimumRangeBox" was added in Inventor 2020.3/2021.
Dim minBox As OrientedBox = body1.OrientedMinimumRangeBox

' Get length of each side of mininum range box.
Dim dir1 As Double = minBox.DirectionOne.Length
Dim dir2 As Double = minBox.DirectionTwo.Length
Dim dir3 As Double = minBox.DirectionThree.Length

' Convert lengths to document's length units.
Dim uom As UnitsOfMeasure = partDoc.UnitsOfMeasure
dir1 = uom.ConvertUnits(dir1, "cm", uom.LengthUnits)
dir2 = uom.ConvertUnits(dir2, "cm", uom.LengthUnits)
dir3 = uom.ConvertUnits(dir3, "cm", uom.LengthUnits)
' Sort lengths from smallest to largest.
Dim lengths As New List(Of Double) From {dir1, dir2, dir3 } lengths.Sort

Dim minLength As Double = lengths(0)
Dim midLength As Double = lengths(1)
Dim maxLength As Double = lengths(2)

'Save into iProperties.Value("Project", "Description
iProperties.Value("Project", "Description") = midLength.ToString("#.###")&"x"& minLength.ToString("#.###")&"x"& maxLength.ToString("#.###")
InventorVb.DocumentUpdate()

 'i need it run this code automatically without i logic 

 

please see screen shot 

 

Thanks in advance

 

Please help 

 

 

 

0 Likes
339 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @ganesh_omkaar.  Is this code in an 'internal' iLogic rule (saved within a document), or in an 'external' iLogic rule?  If it is in an internal rule, then is it in the part document that you want it to effect?  You mentioned something about event trigger taking a long time to saving.  Do you mean that you have already tried adding this rule to the 'Before Save Document' or the 'After Save Document' event within the Event Triggers dialog box, on the 'This Document' tab, while within that part?  If not, then that is what I would recommend that you try.  Or do you mean some other event trigger type of scenario?  Sometimes when you save something like an assembly document, or a drawing document, it may also attempt to save some of other documents being referenced within them, which can take a longer time to process than when saving a part document by itself.  That may be the delay in processing you are seeing if you are working with one of those document types that may be referencing this part.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

ganesh_omkaar
Contributor
Contributor

Can we do this with out i logic and event trigger.is there any method to do that

0 Likes