Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create an ilogic rule for round up length

23 REPLIES 23
SOLVED
Reply
Message 1 of 24
eladm
963 Views, 23 Replies

Create an ilogic rule for round up length

Hi All

I need an ilogic rule for  tube and pipe length 

for example:

eladm_0-1719299310566.png

 

for each pipe when the length (QTY column ) is between 0-4.99 m another column (Item QTY for example) the value will be : 5m .  when the length between 5-9.99 m the value will be 10m , when the length between 10-14.99 m the value will be 15m . If the length will be at inch can it convert to m , and than change the other column value ? 

 

Regards 

 

 

 

Labels (1)
  • rule
23 REPLIES 23
Message 21 of 24
Stakin
in reply to: eladm

please paste the line 7
Message 22 of 24
eladm
in reply to: Stakin

eladm_0-1719818048476.png

 

 

THE ERROR IS ALSO HAPPENING WHEN THERE ONLY 1 PART LIST IN THE DRAWING

eladm_1-1719818136000.png

 

 

Message 23 of 24
Stakin
in reply to: eladm

maybe you copy the code before i modify
Message 24 of 24
Stakin
in reply to: eladm

 

 

 

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oUm As UnitsOfMeasure = oDrawDoc.UnitsOfMeasure	
Dim oSPL As Double = 5000 'oSingle section pipe length(‘mm’)
Dim oILP As Double = 5'Installation loss percentage(0~100)	
For Each oSheet As Sheet In oDrawDoc.Sheets
For Each oPartslist As PartsList In oSheet.PartsLists			
	For Each row As PartsListRow  In oPartslist.PartsListRows
        Row.Item("QTY").Static = False					
		Dim  oValue As Double
		Try 
			oValue = CDbl(Row.Item("QTY").Value)	
		Catch
			oValue = oUm.GetValueFromExpression(Row.Item("QTY").Value, UnitsTypeEnum.kInchLengthUnits)
			oValue=Math.Ceiling(oValue*(10+oILP/10)/oSPL)
		End Try 
		Row.Item("QTY").Value = CStr(oValue)
    Next
Next
Next

 

 

 

 

Just try this.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report