<?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 Total Lenght of 2d and 3d sketch, Possible? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/total-lenght-of-2d-and-3d-sketch-possible/m-p/11887762#M151179</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code that can add all lenght of 2d sketch&amp;nbsp; into a total length. this code does not work with a 3d skecth, can I make a code that work with 3d sketch ? I want to make an content center part for hoses, but I need&amp;nbsp; the total lenght as a properties G_L for our ERP system&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;
Try
	'Find content center family  name
	oDoc =ThisDoc.Document
Dim family = oDoc.PropertySets("{B9600981-DEE8-4547-8D7C-E525B3A1727A}")("Family").Value


If family = "Timing belt" Then 
'Get sketch with loop
Dim oSketch As Sketch = ThisDoc.Document.ComponentDefinition.Sketches("Tooth Belt path")
Dim loopLength As Double = 0

'Iterate all sketch entities
For Each entity As SketchEntity In oSketch.SketchEntities
	'Skip construction entities
	If entity.Construction Then Continue For
	
	Try
		'Get entity length when possible
		Dim entityLength As Double
		entityLength = entity.Length
		'Add entity length to loop length
		loopLength = loopLength + entityLength
	Catch
		'Ignore entities without length
		'For eaxample SketchPoint hasn't length
		Continue For
	End Try
Next
'Use result in mm
 
 Parameter("G_L") = loopLength * 10
End If 
Catch
	
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2023 13:01:51 GMT</pubDate>
    <dc:creator>Darkforce_the_ilogic_guy</dc:creator>
    <dc:date>2023-04-11T13:01:51Z</dc:date>
    <item>
      <title>Total Lenght of 2d and 3d sketch, Possible?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/total-lenght-of-2d-and-3d-sketch-possible/m-p/11887762#M151179</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code that can add all lenght of 2d sketch&amp;nbsp; into a total length. this code does not work with a 3d skecth, can I make a code that work with 3d sketch ? I want to make an content center part for hoses, but I need&amp;nbsp; the total lenght as a properties G_L for our ERP system&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;
Try
	'Find content center family  name
	oDoc =ThisDoc.Document
Dim family = oDoc.PropertySets("{B9600981-DEE8-4547-8D7C-E525B3A1727A}")("Family").Value


If family = "Timing belt" Then 
'Get sketch with loop
Dim oSketch As Sketch = ThisDoc.Document.ComponentDefinition.Sketches("Tooth Belt path")
Dim loopLength As Double = 0

'Iterate all sketch entities
For Each entity As SketchEntity In oSketch.SketchEntities
	'Skip construction entities
	If entity.Construction Then Continue For
	
	Try
		'Get entity length when possible
		Dim entityLength As Double
		entityLength = entity.Length
		'Add entity length to loop length
		loopLength = loopLength + entityLength
	Catch
		'Ignore entities without length
		'For eaxample SketchPoint hasn't length
		Continue For
	End Try
Next
'Use result in mm
 
 Parameter("G_L") = loopLength * 10
End If 
Catch
	
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 13:01:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/total-lenght-of-2d-and-3d-sketch-possible/m-p/11887762#M151179</guid>
      <dc:creator>Darkforce_the_ilogic_guy</dc:creator>
      <dc:date>2023-04-11T13:01:51Z</dc:date>
    </item>
  </channel>
</rss>

