rules

rules

Anonymous
Not applicable
519 Views
9 Replies
Message 1 of 10

rules

Anonymous
Not applicable

Dim repMgr As RepresentationsManager = ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager

 

 

 

'record current LevelOfDetailRepresentation

 

Dim oCurrentRepName As String = repMgr.ActiveLevelOfDetailRepresentation.Name

 

Dim valore As Double

 

 

 

Dim oRep As LevelOfDetailRepresentation

 

Dim oRepName

 

Dim oMass

 

 

 

 

For Each oRep In repMgr.LevelOfDetailRepresentations

 

    oRepName = oRep.Name

 

    'activate this LOD

 

    repMgr.LevelOfDetailRepresentations.Item(oRepName).Activate

 

    'get mass

 

     oMass = iProperties.Mass

 

     'update value of custom property

         

     valore = Math.Round(iProperties.Mass/1000,3) & ( Ton )

     iProperties.Value("Custom", oRepName) = valore  &  " Tons "

         

                 

         

         

         

       

 

Next

 

 

 

 

 

 

'restore

 

repMgr.LevelOfDetailRepresentations.Item(oCurrentRepName).Activate

 

 

"

 

With this rule found on the net I can create
custom parameters that allow me to calculate the weight of everything that I have not suppressed.
it would be useful to have also the specific gravity (to see if when i have only steel it is correct)
but the density doesn't let me put or recall it
I created another rule
that calculates it but I can not get it to take another parameter name
but specific rule:

 

dens = iProperties.Mass / iProperties.Volume

iProperties.Value("Custom", "Pes.sp") = Round(dens * 1000 * 1000, 2) & " g/cm^3"

 

How can I do this?

 

thank you all you are a great community

0 Likes
520 Views
9 Replies
Replies (9)
Message 2 of 10

yan.gauthier
Advocate
Advocate

In iProperties, symply update the mass. It will ask you if you want to considere suppressed elements or not. You don't need a rule to calculate this. 2021-07-12 10_32_20-14856_01-01-001-000-A (Mass Evaluation) iProperties.png

 

The mass and density will be updated accordingly

 

N.B.: *Mass Evaluation is the name of my Level Of Detail

0 Likes
Message 3 of 10

Anonymous
Not applicable

I need a rule that for each weight on the view representation gives me the right density

fsansottera4TBLW_0-1626166259569.png

 

0 Likes
Message 4 of 10

yan.gauthier
Advocate
Advocate

Ok now I understand.

 

is your issue to get several density iProperties ? then you could change 

iProperties.Value("Custom", "Pes.sp") = Round(dens * 1000 * 1000, 2) & " g/cm^3"

to

iProperties.Value("Custom", oRepName + "_Density") = Math.Round(dens * 1000 * 1000, 2) & " g/cm^3"

0 Likes
Message 5 of 10

Anonymous
Not applicable

where ai can change?

0 Likes
Message 6 of 10

yan.gauthier
Advocate
Advocate

Add this below where you create the Mass property inside the for each loop

0 Likes
Message 7 of 10

Anonymous
Not applicable

Sorry i do not understant

 

Dim repMgr As RepresentationsManager = ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager

 

 

 

'record current LevelOfDetailRepresentation

 

Dim oCurrentRepName As String = repMgr.ActiveLevelOfDetailRepresentation.Name

 

Dim valore As Double

 

 

 

Dim oRep As LevelOfDetailRepresentation

 

Dim oRepName

 

Dim oMass

 

 

 

 

For Each oRep In repMgr.LevelOfDetailRepresentations

 

    oRepName = oRep.Name

 

    'activate this LOD

 

    repMgr.LevelOfDetailRepresentations.Item(oRepName).Activate

 

    'get mass

 

     oMass = iProperties.Mass

 

     'update value of custom property

         

     valore = Math.Round(iProperties.Mass/1000,3) & ( Ton )

     iProperties.Value("Custom", oRepName) = valore  &  " Tons "

         

                 

         

         

         

       

 

Next

 

 

 

 

 

 

'restore

 

repMgr.LevelOfDetailRepresentations.Item(oCurrentRepName).Activate

 

 

where i'm insert your solution

0 Likes
Message 8 of 10

yan.gauthier
Advocate
Advocate

 

Dim repMgr As RepresentationsManager = ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager

'record current LevelOfDetailRepresentation

Dim oCurrentRepName As String = repMgr.ActiveLevelOfDetailRepresentation.Name
Dim valore As Double
Dim oRep As LevelOfDetailRepresentation
Dim oRepName
Dim oMass

For Each oRep In repMgr.LevelOfDetailRepresentations

    oRepName = oRep.Name

    'activate this LOD

    repMgr.LevelOfDetailRepresentations.Item(oRepName).Activate

    'get mass

     oMass = iProperties.Mass

     'update value of custom property

     valore = Math.Round(iProperties.Mass/1000,3) & ( Ton )

     iProperties.Value("Custom", oRepName) = valore  &  " Tons "
     iProperties.Value("Custom", oRepName + "_Density") = Math.Round(iProperties.Mass * 1000 * 1000, 2) & " g/cm^3"

Next

'restore

repMgr.LevelOfDetailRepresentations.Item(oCurrentRepName).Activate​

 

 

0 Likes
Message 9 of 10

Anonymous
Not applicable

fsansottera4TBLW_0-1626264788925.png

I want the density to material  to determine if it is one material

whit your solution  I get this

fsansottera4TBLW_1-1626265003725.png

 

 

0 Likes
Message 10 of 10

Anonymous
Not applicable
Dim repMgr As RepresentationsManager = ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager

'record current LevelOfDetailRepresentation

Dim oCurrentRepName As String = repMgr.ActiveLevelOfDetailRepresentation.Name
Dim valore As Double
Dim oRep As LevelOfDetailRepresentation
Dim oRepName
Dim oMass

For Each oRep In repMgr.LevelOfDetailRepresentations

    oRepName = oRep.Name

    'activate this LOD

    repMgr.LevelOfDetailRepresentations.Item(oRepName).Activate

    'get mass

     oMass = iProperties.Mass

     'update value of custom property

     valore = Math.Round(iProperties.Mass/1000,3) & ( Ton )

     iProperties.Value("Custom", oRepName) = valore  &  " Tons "
     iProperties.Value("Custom", oRepName + "_Density") = (iProperties.Mass / iProperties.Volume)*1000000




Next

'restore

repMgr.LevelOfDetailRepresentations.Item(oCurrentRepName).Activate






"I found the solution thanks to you you are great"

 

0 Likes