<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error when round value to 2th decimal in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-round-value-to-2th-decimal/m-p/11609191#M146315</link>
    <description>&lt;P&gt;try this one:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8, digits := 2)&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 09 Dec 2022 13:20:49 GMT</pubDate>
    <dc:creator>CattabianiI</dc:creator>
    <dc:date>2022-12-09T13:20:49Z</dc:date>
    <item>
      <title>Error when round value to 2th decimal</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-round-value-to-2th-decimal/m-p/11609163#M146313</link>
      <description>&lt;P&gt;Hi, I have a problem with this macro:&lt;BR /&gt;the final value of "iProperties.Value("Custom", "DCM_Laser")" I can't round it to the second decimal place: e.g. 0.00&lt;BR /&gt;When I try to add the (value, 2) in the expression I get this error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Neuzzo_0-1670591178029.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150531i1DA563A9B80A1F14/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Neuzzo_0-1670591178029.png" alt="Neuzzo_0-1670591178029.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document = ThisApplication.ActiveDocument
	If Not oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		Exit Sub
	End If
	If Not oDoc.IsModifiable = True Then
		Exit Sub
	End If
	If Not oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
		Exit Sub
	End If
Dim oSMDoc As PartDocument = ThisApplication.ActiveDocument
Dim oSMDef As SheetMetalComponentDefinition = oSMDoc.ComponentDefinition
If oSMDef.HasFlatPattern = False Then
	MsgBox("Manca il modello piatto.", vbOKOnly, "NO FLAT PATTERN")
	Exit Sub
End If
Dim oCompOcc As ComponentOccurrence
	iProperties.Value("Custom", "DCM_Lamiera") = "T"
	Dim oTopFace As Face = oSMDef.FlatPattern.TopFace
	Dim oMeasureTools As MeasureTools = ThisApplication.MeasureTools
	Dim oLoopLength As Double = 0.00
		For Each oEdgeLoop As EdgeLoop In oTopFace.EdgeLoops
		oLoopLength = oLoopLength + oMeasureTools.GetLoopLength(oEdgeLoop)
	Next
If iProperties.Material = "801171 AISI 304 sp.1 2B"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8,2)
	Else If iProperties.Material = "801181 AISI 304 sp. 1.2 2B"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/7.7)
	Else If iProperties.Material = "801211 AISI 304 sp. 2 2B"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/5)
	Else If iProperties.Material = "811151 AISI 304 sp. 0.8 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8.2)
	Else If iProperties.Material = "811175 AISI 304 sp. 1 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8)
	Else If iProperties.Material = "811181 AISI 304 sp. 1.2 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/7.7)
	Else If iProperties.Material = "811191 AISI 304 sp. 1.5 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/7)
	Else If iProperties.Material = "811194 AISI 304 sp. 2 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/4.6)
	Else If iProperties.Material = "811196 AISI 304 sp. 3 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/2.5)
	Else If iProperties.Material = "811501 AISI 430 sp. 3 BA"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/2.5)
	Else If iProperties.Material = "811525 AISI 430 sp. 0.8 BA"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8.2)
	Else If iProperties.Material = "811531 AISI 430 sp. 0.8 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8.2)
	Else If iProperties.Material = "811535 AISI 430 sp. 0.8 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8.2)
	Else If iProperties.Material = "811541 AISI 430 sp. 1 SB + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8)
	Else If iProperties.Material = "811547 AISI 430 sp. 1 BA"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8)
	Else If iProperties.Material = "811583 AISI 430 sp. 1.5 BA"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/7)
	Else If iProperties.Material = "811585 AISI 430 sp. 1.5 BA + PVC"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/7)
	Else If iProperties.Material = "811587 AISI 430 sp. 2 BA"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/4.6)
	Else If iProperties.Material = "811813 ALLUMINATA sp. 0.8"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8.2)
	Else If iProperties.Material = "811817 ALLUMINATA sp. 1"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8.2)
	Else If iProperties.Material = "811819 ALLUMINATA sp. 1.5"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/7)
	Else If iProperties.Material = "811823 ALLUMINATA sp. 2"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/5)
	Else If iProperties.Material = "811931 Fe sp. 2"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/5.5)
	Else If iProperties.Material = "811937 Fe sp. 3"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/4)
	Else If iProperties.Material = "811939 FE-ZINCATO sp. 2"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/5.5)
	Else If iProperties.Material = "811941 FE-ZINCATO sp. 3"
		iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/4)
End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I solve it? Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 13:06:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-round-value-to-2th-decimal/m-p/11609163#M146313</guid>
      <dc:creator>Neuzzo</dc:creator>
      <dc:date>2022-12-09T13:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error when round value to 2th decimal</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-round-value-to-2th-decimal/m-p/11609191#M146315</link>
      <description>&lt;P&gt;try this one:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;iProperties.Value("Custom", "DCM_Laser") = Round((oLoopLength/100)/8, digits := 2)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Dec 2022 13:20:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-round-value-to-2th-decimal/m-p/11609191#M146315</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2022-12-09T13:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error when round value to 2th decimal</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-round-value-to-2th-decimal/m-p/11609214#M146317</link>
      <description>It work. Thank you</description>
      <pubDate>Fri, 09 Dec 2022 13:26:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-round-value-to-2th-decimal/m-p/11609214#M146317</guid>
      <dc:creator>Neuzzo</dc:creator>
      <dc:date>2022-12-09T13:26:27Z</dc:date>
    </item>
  </channel>
</rss>

