Create an ilogic rule for round up length

Create an ilogic rule for round up length

eladm
Collaborator Collaborator
1,319 Views
23 Replies
Message 1 of 24

Create an ilogic rule for round up length

eladm
Collaborator
Collaborator

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 

 

 

 

0 Likes
Accepted solutions (2)
1,320 Views
23 Replies
  • rule
Replies (23)
Message 21 of 24

Stakin
Collaborator
Collaborator
please paste the line 7
0 Likes
Message 22 of 24

eladm
Collaborator
Collaborator

eladm_0-1719818048476.png

 

 

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

eladm_1-1719818136000.png

 

 

0 Likes
Message 23 of 24

Stakin
Collaborator
Collaborator
maybe you copy the code before i modify
0 Likes
Message 24 of 24

Stakin
Collaborator
Collaborator

 

 

 

 

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.

0 Likes