<?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: ILogic export flat pattern with dimension in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10794031#M42991</link>
    <description>&lt;P&gt;The error message is correct in the ilogic editor you can use ilogic or vb.net code. Any code that has a sub or function will likely be vb.net and will need sub main and end sub to start and finish the rule. ThisApplication was also missing as _invapplication refers to an addin or missing section of code. There&amp;nbsp;is also a file path that needs to be changed to suit the part being worked on. “C:\Users\t_makaf\OneDrive - Autodesk\Desktop\sheet.ipt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11760879"&gt;@randy.redekop&lt;/a&gt;&amp;nbsp; Your code supplied has no sub/function routine so can be used as is.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sub Main()&lt;/P&gt;&lt;P&gt;‘Insert code here&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have corrected what I could see in the below code but have not tested this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Sub Main()
'Sets inventor application
 _InvApplication = ThisApplication

Dim oDrawingDoc As DrawingDocument
        oDrawingDoc = _InvApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject,
                                _InvApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kDrawingDocumentObject))

        ' Create a new B size sheet.
        Dim oSheet As Sheet
        oSheet = oDrawingDoc.Sheets.Add(DrawingSheetSizeEnum.kBDrawingSheetSize)


        ' Add the default border.
        oSheet.AddDefaultBorder()

        ' Open the block document, invisibly.

        Dim oPartDoc As PartDocument
        oPartDoc = _InvApplication.Documents.Open("C:\Users\t_makaf\OneDrive - Autodesk\Desktop\sheet.ipt", False)

        Dim oTG As TransientGeometry
        oTG = _InvApplication.TransientGeometry

        ' Create the base view.
        Dim oBaseView As DrawingView
        oBaseView = oDrawingDoc.ActiveSheet.DrawingViews.AddBaseView(oPartDoc, oTG.CreatePoint2d(35, 20), 1,
                                                     ViewOrientationTypeEnum.kFrontViewOrientation,
                                                     DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)


        Dim oDrawing As DrawingDocument
        oDrawing = _InvApplication.ActiveDocument

        Dim oView As DrawingView
        oView = oDrawing.ActiveSheet.DrawingViews(1)

        Dim oDimColl As GeneralDimensionsEnumerator
        oDimColl = oDrawing.ActiveSheet.DrawingDimensions.GeneralDimensions.Retrieve(oView)


        ''dimensioning

        Dim oSelectedCurve As DrawingCurve = Nothing

        For Each oCurve As DrawingCurve In oBaseView.DrawingCurves

            ' Skip Circles
            If Not oCurve.StartPoint Is Nothing And Not oCurve.EndPoint Is Nothing Then

                If (WithinTol(oCurve.StartPoint.X, oCurve.EndPoint.X, 0.001)) Then

                    If oSelectedCurve Is Nothing Then

                        ' This is the first horizontal curve found.
                        oSelectedCurve = oCurve

                    Else

                        ' Check to see if this curve is higher (smaller x value) than the current selected
                        If oCurve.MidPoint.X &amp;lt; oSelectedCurve.MidPoint.X Then
                            oSelectedCurve = oCurve
                        End If

                    End If

                End If

            End If
        Next

        If oSelectedCurve Is Nothing Then
            MessageBox.Show("no curve selected!")
            Exit Sub
        End If

        ' Create geometry intents point for the curve.

        Dim oGeomIntent1 As GeometryIntent = oSheet.CreateGeometryIntent(oSelectedCurve, PointIntentEnum.kStartPointIntent)
        Dim oGeomIntent2 As GeometryIntent = oSheet.CreateGeometryIntent(oSelectedCurve, PointIntentEnum.kEndPointIntent)

        Dim oGeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions

        Dim oDimPos As Point2d = oTG.CreatePoint2d(oSelectedCurve.MidPoint.X - 2, oSelectedCurve.MidPoint.Y)

        ' Create the dimension.
        Dim oLinearDim As LinearGeneralDimension
        oLinearDim = oGeneralDimensions.AddLinear(oDimPos, oGeomIntent1, oGeomIntent2, DimensionTypeEnum.kAlignedDimensionType)
Private Function WithinTol(ByVal Value1 As Double, ByVal Value2 As Double, ByVal tol As Double) As Boolean

        Return (Math.Abs(Value1 - Value2) &amp;lt; tol)

    End Function
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2021 17:03:50 GMT</pubDate>
    <dc:creator>A.Acheson</dc:creator>
    <dc:date>2021-12-01T17:03:50Z</dc:date>
    <item>
      <title>ILogic export flat pattern with dimension</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10791817#M42985</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fairly new to iLogic so any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm trying to find a way to where I use iLogic to export my flat pattern and also place dimensions on it.&amp;nbsp; Ive been looking around forums and cant find anything.&amp;nbsp; I don't know if getting dimensions on the holes is even possible but it would be great if it worked. Ill attach a picture of what I'm looking for. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 20:24:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10791817#M42985</guid>
      <dc:creator>randy.redekop</dc:creator>
      <dc:date>2021-11-30T20:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic export flat pattern with dimension</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10792776#M42986</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11760879"&gt;@randy.redekop&lt;/a&gt;&amp;nbsp;have you looked into the inventor API docs?&lt;/P&gt;
&lt;P&gt;For exporting into DXf kindly this is the VB code&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-5E8D441D-0F9E-4E54-8E49-3EEA8FEE8FCE" target="_blank"&gt;Inventor 2022 Help | Export to DWF | Autodesk&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;you can also export to other formats like DWG,STEP,PDF&lt;/P&gt;
&lt;P&gt;For dimensioning this is the sample code&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-90949ED0-D8E8-4A89-A10D-A7659132506A" target="_blank"&gt;Inventor 2022 Help | Create linear foreshortened dimension sample | Autodesk&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;let me know if this helps&amp;nbsp; and in case of any clarification&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 07:41:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10792776#M42986</guid>
      <dc:creator>fidel.makatiaD5W7V</dc:creator>
      <dc:date>2021-12-01T07:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic export flat pattern with dimension</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10792788#M42987</link>
      <description>&lt;P&gt;You can't edit the dxf export using the flatpattern export functions.&lt;/P&gt;&lt;P&gt;But I think the easiest way would be creating a drawing sheet (without border and titleblock) with a 1:1 scaled view of your flatpattern. Add dimensions etc. then do an export of the drawing to dxf.&lt;/P&gt;&lt;P&gt;Automating annotations on a drawing from scratch can be difficult. But if you use 3d annotations in your flatpattern, you can retrieve then in you drawing.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 07:47:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10792788#M42987</guid>
      <dc:creator>theo.bot</dc:creator>
      <dc:date>2021-12-01T07:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic export flat pattern with dimension</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10792824#M42988</link>
      <description>&lt;P&gt;Also,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11760879"&gt;@randy.redekop&lt;/a&gt;&amp;nbsp;check the following VB.NET code I developed sometimes back that takes a sheet metal as input then converts it to a drawing file with dimensions.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt; Dim oDrawingDoc As DrawingDocument
        oDrawingDoc = _InvApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject,
                                _InvApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kDrawingDocumentObject))

        ' Create a new B size sheet.
        Dim oSheet As Sheet
        oSheet = oDrawingDoc.Sheets.Add(DrawingSheetSizeEnum.kBDrawingSheetSize)


        ' Add the default border.
        oSheet.AddDefaultBorder()

        ' Open the block document, invisibly.

        Dim oPartDoc As PartDocument
        oPartDoc = _InvApplication.Documents.Open("C:\Users\t_makaf\OneDrive - Autodesk\Desktop\sheet.ipt", False)

        Dim oTG As TransientGeometry
        oTG = _InvApplication.TransientGeometry

        ' Create the base view.
        Dim oBaseView As DrawingView
        oBaseView = oDrawingDoc.ActiveSheet.DrawingViews.AddBaseView(oPartDoc, oTG.CreatePoint2d(35, 20), 1,
                                                     ViewOrientationTypeEnum.kFrontViewOrientation,
                                                     DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)


        Dim oDrawing As DrawingDocument
        oDrawing = _InvApplication.ActiveDocument

        Dim oView As DrawingView
        oView = oDrawing.ActiveSheet.DrawingViews(1)

        Dim oDimColl As GeneralDimensionsEnumerator
        oDimColl = oDrawing.ActiveSheet.DrawingDimensions.GeneralDimensions.Retrieve(oView)


        ''dimensioning

        Dim oSelectedCurve As DrawingCurve = Nothing

        For Each oCurve As DrawingCurve In oBaseView.DrawingCurves

            ' Skip Circles
            If Not oCurve.StartPoint Is Nothing And Not oCurve.EndPoint Is Nothing Then

                If (WithinTol(oCurve.StartPoint.X, oCurve.EndPoint.X, 0.001)) Then

                    If oSelectedCurve Is Nothing Then

                        ' This is the first horizontal curve found.
                        oSelectedCurve = oCurve

                    Else

                        ' Check to see if this curve is higher (smaller x value) than the current selected
                        If oCurve.MidPoint.X &amp;lt; oSelectedCurve.MidPoint.X Then
                            oSelectedCurve = oCurve
                        End If

                    End If

                End If

            End If
        Next

        If oSelectedCurve Is Nothing Then
            MessageBox.Show("no curve selected!")
            Exit Sub
        End If

        ' Create geometry intents point for the curve.

        Dim oGeomIntent1 As GeometryIntent = oSheet.CreateGeometryIntent(oSelectedCurve, PointIntentEnum.kStartPointIntent)
        Dim oGeomIntent2 As GeometryIntent = oSheet.CreateGeometryIntent(oSelectedCurve, PointIntentEnum.kEndPointIntent)

        Dim oGeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions

        Dim oDimPos As Point2d = oTG.CreatePoint2d(oSelectedCurve.MidPoint.X - 2, oSelectedCurve.MidPoint.Y)

        ' Create the dimension.
        Dim oLinearDim As LinearGeneralDimension
        oLinearDim = oGeneralDimensions.AddLinear(oDimPos, oGeomIntent1, oGeomIntent2, DimensionTypeEnum.kAlignedDimensionType)
Private Function WithinTol(ByVal Value1 As Double, ByVal Value2 As Double, ByVal tol As Double) As Boolean

        Return (Math.Abs(Value1 - Value2) &amp;lt; tol)

    End Function&lt;/LI-CODE&gt;
&lt;P&gt;nsions&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 08:10:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10792824#M42988</guid>
      <dc:creator>fidel.makatiaD5W7V</dc:creator>
      <dc:date>2021-12-01T08:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic export flat pattern with dimension</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10793539#M42989</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11310889"&gt;@fidel.makatiaD5W7V&lt;/a&gt;, thank you for the reply. I am trying to use your code but i get a "Line 1:Rule needs a Sub Main() and End Sub" Error. Sorry i am very new to coding and using Ilogic. The Macro i am using right now is below. It works for creating a flat pattern and exporting it but im still looking to add dimensions with it. This is being used for our laser nesting guys so they can import the part without opening autocad or inventor and still have dimensions to double check that it matches with the print.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;
&lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;SubType&lt;/SPAN&gt; = &lt;SPAN&gt;"{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	
	&lt;SPAN&gt;sFile&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;
	
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDesiredFolder&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;sFile&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\Flat Pattern"&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oDesiredFolder&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDirectory&lt;/SPAN&gt;(&lt;SPAN&gt;oDesiredFolder&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SheetMetalComponentDefinition&lt;/SPAN&gt;
	
	&lt;SPAN&gt;oCompDef&lt;/SPAN&gt; = &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
	
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		
		&lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Unfold&lt;/SPAN&gt;
		&lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;/SPAN&gt;.&lt;SPAN&gt;ExitEdit&lt;/SPAN&gt;
		
		&lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;
		
		&lt;SPAN&gt;Else&lt;/SPAN&gt;
			
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
		
		&lt;SPAN&gt;dwgFileName&lt;/SPAN&gt; = &lt;SPAN&gt;sFile&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"Flat Pattern\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".FlatPattern.dwg"&lt;/SPAN&gt;
	
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDataIO&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DataIO&lt;/SPAN&gt;
	&lt;SPAN&gt;oDataIO&lt;/SPAN&gt; = &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;DataIO&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sOut&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
	&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;"FLAT PATTERN DWG?AcadVersion=2004&amp;amp;InvisibleLayers=IV_ARC_CENTERS;IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_FEATURE_PROFILES;IV_FEATURE_PROFILES_DOWN;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_UNCOMSUMED_SKETCHES;IV_ROLL_TANGENT;IV_ROLL"&lt;/SPAN&gt;
	&lt;SPAN&gt;oDataIO&lt;/SPAN&gt;.&lt;SPAN&gt;WriteDataToFile&lt;/SPAN&gt;(&lt;SPAN&gt;sOut&lt;/SPAN&gt;, &lt;SPAN&gt;dwgFileName&lt;/SPAN&gt;)

	
	
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;SubType&lt;/SPAN&gt; = &lt;SPAN&gt;"{4D29B490-49B2-11D0-93C3-7E0706000000}"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			
			
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDesiredFolder&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;sFile&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\Tube Laser"&lt;/SPAN&gt;
			&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oDesiredFolder&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDirectory&lt;/SPAN&gt;(&lt;SPAN&gt;oDesiredFolder&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oStepTranslator&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&lt;/SPAN&gt;
			&lt;SPAN&gt;oStepTranslator&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ApplicationAddIns&lt;/SPAN&gt;.&lt;SPAN&gt;ItemById&lt;/SPAN&gt;(&lt;SPAN&gt;"{90AF7F40-0C01-11D5-8E83-0010B541CD80}"&lt;/SPAN&gt;)
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oContext&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslationContext&lt;/SPAN&gt;
			&lt;SPAN&gt;oContext&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateTranslationContext&lt;/SPAN&gt;
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOptions&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;NameValueMap&lt;/SPAN&gt;
			&lt;SPAN&gt;oOptions&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateNameValueMap&lt;/SPAN&gt;
			
			&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oStepTranslator&lt;/SPAN&gt;.&lt;SPAN&gt;HasSaveCopyAsOptions&lt;/SPAN&gt;(&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
			
			&lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"ApplicationProtocolType"&lt;/SPAN&gt;) = 3
			
			&lt;SPAN&gt;oContext&lt;/SPAN&gt;.&lt;SPAN&gt;Type&lt;/SPAN&gt; = &lt;SPAN&gt;IOMechanismEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kFileBrowseIOMechanism&lt;/SPAN&gt;
			
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oData&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DataMedium&lt;/SPAN&gt;
			&lt;SPAN&gt;oData&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;
			
			
			&lt;SPAN&gt;oData&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\Tube Laser\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"TL.stp"&lt;/SPAN&gt;
			
			&lt;SPAN&gt;oStepTranslator&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;, &lt;SPAN&gt;oData&lt;/SPAN&gt;)
			
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Dec 2021 13:41:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10793539#M42989</guid>
      <dc:creator>randy.redekop</dc:creator>
      <dc:date>2021-12-01T13:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic export flat pattern with dimension</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10793542#M42990</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11760879"&gt;@randy.redekop&lt;/a&gt;&amp;nbsp;let me check your code&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 13:42:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10793542#M42990</guid>
      <dc:creator>fidel.makatiaD5W7V</dc:creator>
      <dc:date>2021-12-01T13:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic export flat pattern with dimension</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10794031#M42991</link>
      <description>&lt;P&gt;The error message is correct in the ilogic editor you can use ilogic or vb.net code. Any code that has a sub or function will likely be vb.net and will need sub main and end sub to start and finish the rule. ThisApplication was also missing as _invapplication refers to an addin or missing section of code. There&amp;nbsp;is also a file path that needs to be changed to suit the part being worked on. “C:\Users\t_makaf\OneDrive - Autodesk\Desktop\sheet.ipt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11760879"&gt;@randy.redekop&lt;/a&gt;&amp;nbsp; Your code supplied has no sub/function routine so can be used as is.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sub Main()&lt;/P&gt;&lt;P&gt;‘Insert code here&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have corrected what I could see in the below code but have not tested this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Sub Main()
'Sets inventor application
 _InvApplication = ThisApplication

Dim oDrawingDoc As DrawingDocument
        oDrawingDoc = _InvApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject,
                                _InvApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kDrawingDocumentObject))

        ' Create a new B size sheet.
        Dim oSheet As Sheet
        oSheet = oDrawingDoc.Sheets.Add(DrawingSheetSizeEnum.kBDrawingSheetSize)


        ' Add the default border.
        oSheet.AddDefaultBorder()

        ' Open the block document, invisibly.

        Dim oPartDoc As PartDocument
        oPartDoc = _InvApplication.Documents.Open("C:\Users\t_makaf\OneDrive - Autodesk\Desktop\sheet.ipt", False)

        Dim oTG As TransientGeometry
        oTG = _InvApplication.TransientGeometry

        ' Create the base view.
        Dim oBaseView As DrawingView
        oBaseView = oDrawingDoc.ActiveSheet.DrawingViews.AddBaseView(oPartDoc, oTG.CreatePoint2d(35, 20), 1,
                                                     ViewOrientationTypeEnum.kFrontViewOrientation,
                                                     DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)


        Dim oDrawing As DrawingDocument
        oDrawing = _InvApplication.ActiveDocument

        Dim oView As DrawingView
        oView = oDrawing.ActiveSheet.DrawingViews(1)

        Dim oDimColl As GeneralDimensionsEnumerator
        oDimColl = oDrawing.ActiveSheet.DrawingDimensions.GeneralDimensions.Retrieve(oView)


        ''dimensioning

        Dim oSelectedCurve As DrawingCurve = Nothing

        For Each oCurve As DrawingCurve In oBaseView.DrawingCurves

            ' Skip Circles
            If Not oCurve.StartPoint Is Nothing And Not oCurve.EndPoint Is Nothing Then

                If (WithinTol(oCurve.StartPoint.X, oCurve.EndPoint.X, 0.001)) Then

                    If oSelectedCurve Is Nothing Then

                        ' This is the first horizontal curve found.
                        oSelectedCurve = oCurve

                    Else

                        ' Check to see if this curve is higher (smaller x value) than the current selected
                        If oCurve.MidPoint.X &amp;lt; oSelectedCurve.MidPoint.X Then
                            oSelectedCurve = oCurve
                        End If

                    End If

                End If

            End If
        Next

        If oSelectedCurve Is Nothing Then
            MessageBox.Show("no curve selected!")
            Exit Sub
        End If

        ' Create geometry intents point for the curve.

        Dim oGeomIntent1 As GeometryIntent = oSheet.CreateGeometryIntent(oSelectedCurve, PointIntentEnum.kStartPointIntent)
        Dim oGeomIntent2 As GeometryIntent = oSheet.CreateGeometryIntent(oSelectedCurve, PointIntentEnum.kEndPointIntent)

        Dim oGeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions

        Dim oDimPos As Point2d = oTG.CreatePoint2d(oSelectedCurve.MidPoint.X - 2, oSelectedCurve.MidPoint.Y)

        ' Create the dimension.
        Dim oLinearDim As LinearGeneralDimension
        oLinearDim = oGeneralDimensions.AddLinear(oDimPos, oGeomIntent1, oGeomIntent2, DimensionTypeEnum.kAlignedDimensionType)
Private Function WithinTol(ByVal Value1 As Double, ByVal Value2 As Double, ByVal tol As Double) As Boolean

        Return (Math.Abs(Value1 - Value2) &amp;lt; tol)

    End Function
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 17:03:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-export-flat-pattern-with-dimension/m-p/10794031#M42991</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2021-12-01T17:03:50Z</dc:date>
    </item>
  </channel>
</rss>

