<?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: My ilogic code can't run it got the following error, I hope the experts can help me in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085357#M21614</link>
    <description>&lt;BR /&gt;Your code has some errors&lt;BR /&gt;Error on Line 58 : 'kFrontViewOrientation' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;Error on Line 58 : 'kHiddenLineDrawingViewStyle' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;Error on Line 63 : 'kHiddenLineDrawingViewStyle' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;Error on Line 65 : 'kHiddenLineDrawingViewStyle' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;&lt;BR /&gt;and warnings&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oBaseView'.&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oView2'.&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oView3'.&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oView4'.&lt;BR /&gt;</description>
    <pubDate>Fri, 07 Jul 2023 03:48:58 GMT</pubDate>
    <dc:creator>ngtatsang98</dc:creator>
    <dc:date>2023-07-07T03:48:58Z</dc:date>
    <item>
      <title>My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12081770#M21604</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;Code ilogic của mình không chạy được nó bị lỗi như sau, mong các chuyên gia giúp mình&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 18:40:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12081770#M21604</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-05T18:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12081811#M21605</link>
      <description>&lt;P&gt;&lt;SPAN&gt;ilogic , automatically export drawings with errors&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 18:53:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12081811#M21605</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-05T18:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083789#M21606</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8207561"&gt;@ngtatsang98&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you show the more info tab of the error message box? The first tab only suggest there is an error but the second will give a little more information as to what the error is. Also have you narrowed down approximately where the rule is failing? If not place in a message box move it down each line untill you cannot see it being launched. This will help narrow down what to look at.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 14:03:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083789#M21606</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-07-06T14:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083806#M21607</link>
      <description>&lt;P&gt;More infor:&lt;BR /&gt;System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))&lt;BR /&gt;at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;at Inventor.Documents.Add(DocumentTypeEnum DocumentType, String TemplateFileName, Boolean CreateVisible)&lt;BR /&gt;at LmiRuleScript.CreateDrawing_PlaceViews(String PartNumber, Double DrawingViewScale, String ViewsToPlace, Boolean AssemblyDrawing, DrawingView&amp;amp; oBaseView, DrawingView&amp;amp; oView2, DrawingView&amp;amp; oView3, DrawingView&amp;amp; oView4)&lt;BR /&gt;at LmiRuleScript.Main()&lt;BR /&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 14:12:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083806#M21607</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-06T14:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083880#M21608</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8207561"&gt;@ngtatsang98&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error suggest there is a missing string object. Does the template file path exist? There could be other string errors but that is a good one to check first. If it does exist I would suggest turn off all other actions and get that function to work first.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Function &lt;STRONG&gt;CreateDrawing_PlaceViews&lt;/STRONG&gt; Check this path.&lt;/P&gt;&lt;P&gt;"C:\Users\Public\Documents\Autodesk\Inventor 2017\Templates\standard.dwg"&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 14:31:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083880#M21608</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-07-06T14:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083892#M21609</link>
      <description>&lt;P&gt;&lt;SPAN&gt;yes it worked partially then got the error again&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Error in rule: Rule0, in document: Part5.ipt&lt;/P&gt;&lt;P&gt;The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))&lt;BR /&gt;&lt;BR /&gt;More info:&lt;/P&gt;&lt;P&gt;System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))&lt;BR /&gt;at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;at Inventor.DimensionStylesEnumerator.get_Item(Object Index)&lt;BR /&gt;at LmiRuleScript.CreateLinearDimension(DrawingDocument oDrawingDoc, DrawingView oDrawingView, DoubleForEquals DimensionLength, String DirectionOfDim, Double OffsetDistance, String DimensionLocation, Boolean ReferencedDim)&lt;BR /&gt;at LmiRuleScript.Main()&lt;BR /&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 14:36:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083892#M21609</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-06T14:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083940#M21610</link>
      <description>&lt;P&gt;You have a string error in&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;String "DimensionLocation" but I am not sure why it is saying in part5.ipt.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 14:48:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083940#M21610</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-07-06T14:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083969#M21611</link>
      <description>it still doesn't seem to work , part5 is the filename where i run this code .&lt;BR /&gt;This code is not written by me so I can't understand it, I hope you can fix it</description>
      <pubDate>Thu, 06 Jul 2023 14:57:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083969#M21611</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-06T14:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083997#M21612</link>
      <description>I use inventor 2018 version, this code is recommended for 2017 version</description>
      <pubDate>Thu, 06 Jul 2023 15:05:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12083997#M21612</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-06T15:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085275#M21613</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8207561"&gt;@ngtatsang98&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if I remember this forum post this code was in is about 100 messages long so this code for sure has major functionality but it really is specific to that users workflow and so is very specific. Can you edit the first post and add the forum post link to where you found the code as it is always good practice to reference the original authors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your only starting out automating drawings I would suggest to start off small and just keep it simple.&lt;/P&gt;&lt;P&gt;I have modified the original rule to just do the basics. You can add and modify it later if you know what the next task you need is.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Option Explicit On
Sub Main()

	'Ask to Create Drawing
	Dim AskCreateDrawing As MsgBoxResult = MessageBox.Show("Would you like to Create Drawings for the Current Model?", "Drawing Automation",MessageBoxButtons.YesNo)
	
	'If the User Presses YES
	If AskCreateDrawing = vbYes Then
		
		'Set the View Scales
		Dim DrawingViewScale As Double = 1/10
		Dim oBaseView,oView2,oView3,oView4 As DrawingView
		Dim sAssyFileName As String = ThisDoc.FileName(False) 'without extension
		
		Dim oDrawDoc As DrawingDocument = CreateDrawing_PlaceViews (sAssyFileName, DrawingViewScale, "Right_Project", True)
		
		'Save As oDrawingDoc (Path and File Name) 
		Dim sPath As String = ThisDoc.Path

		Dim sDrawFullFileName As String = sPath &amp;amp; "\" &amp;amp; sAssyFileName &amp;amp; ".dwg"
			
		oDrawDoc.SaveAs(sDrawFullFileName, False)
		
	End If

End Sub

Function CreateDrawing_PlaceViews (PartNumber As String, DrawingViewScale As Double, ViewsToPlace As String, AssemblyDrawing As Boolean)

	Dim oDrawDoc As DrawingDocument
	Dim oPartDoc As Document
	Dim oSheet As Sheet
	Dim oTG As TransientGeometry
	Dim oPoint1,oPoint2,oPoint3,oPoint4 As Point2d
	Dim oBaseView,oView2,oView3,oView4 As DrawingView
	
	'If this is the Assembly View, then use this Document as reference and open Drawing Template
	'Otherwise use the given Part Number And invisibly open the part, Use the active drawing
	If AssemblyDrawing = True Then
		oPartDoc = ThisDoc.Document
		oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2018\Templates\standard.dwg", True)
	Else If AssemblyDrawing = False 
		Dim sPartDocPath As String = ThisDoc.Path &amp;amp; "\" &amp;amp; PartNumber &amp;amp; ".ipt"
		oPartDoc = ThisApplication.Documents.Open(sPartDocPath, False)
		oDrawDoc = ThisApplication.ActiveDocument 
	End If
	
	oSheet = oDrawDoc.Sheets.Item(1)
	oTG = ThisApplication.TransientGeometry
	
	'Set points in order to get wanted View (ie. if 'Y' is the same and 'X' is greater or less, you will get a Side View)
	oPoint1 = oTG.CreatePoint2d(5, 5)
	oPoint2 = oTG.CreatePoint2d(5, 30)
	oPoint3 = oTG.CreatePoint2d(30, 5)
	oPoint4 = oTG.CreatePoint2d(30, 30)
	
	'Create the Base View
	oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, DrawingViewScale, kFrontViewOrientation, kHiddenLineDrawingViewStyle, "Default")
	oBaseView.ShowLabel = True
	
	'//////// Place the rest of the Projected Views According to the Parameter String Specified ////////////
	
	oView2 = oSheet.DrawingViews.AddProjectedView(oBaseView, oPoint3, kHiddenLineDrawingViewStyle, DrawingViewScale)
	oView2.ShowLabel = True
	oView3 = oSheet.DrawingViews.AddProjectedView(oBaseView, oPoint4, kHiddenLineDrawingViewStyle, DrawingViewScale)
	oView3.ShowLabel = True

	'Return the Drawing Document 
	Return oDrawDoc

End Function
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Jul 2023 02:10:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085275#M21613</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-07-07T02:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085357#M21614</link>
      <description>&lt;BR /&gt;Your code has some errors&lt;BR /&gt;Error on Line 58 : 'kFrontViewOrientation' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;Error on Line 58 : 'kHiddenLineDrawingViewStyle' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;Error on Line 63 : 'kHiddenLineDrawingViewStyle' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;Error on Line 65 : 'kHiddenLineDrawingViewStyle' is not declared. It may be inaccessible due to its protection level.&lt;BR /&gt;&lt;BR /&gt;and warnings&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oBaseView'.&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oView2'.&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oView3'.&lt;BR /&gt;Warning on Line 12 : Unused local variable: 'oView4'.&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jul 2023 03:48:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085357#M21614</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-07T03:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085366#M21615</link>
      <description>The code I found has almost no instructions, but I'm sure it does the output of the drawing fill in dimensions automatically.&lt;BR /&gt;this is where i found it:&lt;BR /&gt;&lt;A href="https://github.com/AlexFielder/iLogic/blob/master/Drawings/Drawing%20Automation%20Code.iLogicVb" target="_blank"&gt;https://github.com/AlexFielder/iLogic/blob/master/Drawings/Drawing%20Automation%20Code.iLogicVb&lt;/A&gt;</description>
      <pubDate>Fri, 07 Jul 2023 03:57:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085366#M21615</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-07T03:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085460#M21616</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8207561"&gt;@ngtatsang98&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just comment off this line as I was using that to better declare variables.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;'Option Explicit On&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 05:48:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085460#M21616</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-07-07T05:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085815#M21617</link>
      <description>I tried again it seems to go back to the original error&lt;BR /&gt;The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))&lt;BR /&gt;&amp;nbsp;More info&lt;BR /&gt;System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))&lt;BR /&gt;at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;at Inventor.DrawingViews.AddBaseView(_Document Model, Point2d Position, Double Scale, ViewOrientationTypeEnum ViewOrientation, DrawingViewStyleEnum ViewStyle, String ModelViewName, Object ArbitraryCamera, Object AdditionalOptions)&lt;BR /&gt;at LmiRuleScript.CreateDrawing_PlaceViews(String PartNumber, Double DrawingViewScale, String ViewsToPlace, Boolean AssemblyDrawing)&lt;BR /&gt;at LmiRuleScript.Main()&lt;BR /&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&amp;nbsp;</description>
      <pubDate>Fri, 07 Jul 2023 09:35:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12085815#M21617</guid>
      <dc:creator>ngtatsang98</dc:creator>
      <dc:date>2023-07-07T09:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: My ilogic code can't run it got the following error, I hope the experts can help me</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12088449#M21618</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8207561"&gt;@ngtatsang98&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you launch the rule from a drawing? If so the function would be supplying the drawing document to the view which of course would be wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a more simplified version of the same rule with some document checks. Also the document is supplied from one source set at the start of the rule and passed into the function as an argument.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
	
	Dim oDoc As Document = ThisDoc.Document
	If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then MessageBox.Show("Not a Part/Assembly so Exiting!","Error" ) : Exit Sub 
		
	'Ask to Create Drawing
	Dim AskCreateDrawing As MsgBoxResult = MessageBox.Show("Would you like to Create Drawings for the Current Model?", "Drawing Automation",MessageBoxButtons.YesNo)
	
	'If the User Presses YES
	If Not AskCreateDrawing = vbYes Then Exit Sub 
		
	'Set the View Scales
	Dim DrawingViewScale As Double = 1/10
	Dim oBaseView,oView2,oView3,oView4 As DrawingView
	Dim sAssyFileName As String = ThisDoc.FileName(False) 'without extension

	Dim oDrawDoc As DrawingDocument = CreateDrawing_PlaceViews (oDoc, DrawingViewScale)
	
	'Save As oDrawingDoc (Path and File Name) 
	Dim sPath As String = ThisDoc.Path

	Dim sDrawFullFileName As String = sPath &amp;amp; "\" &amp;amp; sAssyFileName &amp;amp; ".dwg"
		
	oDrawDoc.SaveAs(sDrawFullFileName, False)
		
End Sub

Function CreateDrawing_PlaceViews (oDoc As Document, DrawingViewScale As Double)

	Dim oPoint1,oPoint2,oPoint3,oPoint4 As Point2d
	Dim oBaseView,oView2,oView3,oView4 As DrawingView
	
	Dim oDrawDoc As DrawingDocument = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2018\Templates\standard.dwg", True)
	Dim oSheet As Sheet = oDrawDoc.Sheets.Item(1)
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	
	'Set points in order to get wanted View (ie. if 'Y' is the same and 'X' is greater or less, you will get a Side View)
	oPoint1 = oTG.CreatePoint2d(5, 5)
	oPoint2 = oTG.CreatePoint2d(5, 30)
	oPoint3 = oTG.CreatePoint2d(30, 5)
	oPoint4 = oTG.CreatePoint2d(30, 30)
	
	'Create the Base View
	oBaseView = oSheet.DrawingViews.AddBaseView(oDoc, oPoint1, DrawingViewScale, kFrontViewOrientation, kHiddenLineDrawingViewStyle, "Default")
	oBaseView.ShowLabel = True
	
	'//////// Place the rest of the Projected Views According to the Parameter String Specified ////////////
	
	oView2 = oSheet.DrawingViews.AddProjectedView(oBaseView, oPoint3, kHiddenLineDrawingViewStyle, DrawingViewScale)
	oView2.ShowLabel = True
	oView3 = oSheet.DrawingViews.AddProjectedView(oBaseView, oPoint4, kHiddenLineDrawingViewStyle, DrawingViewScale)
	oView3.ShowLabel = True

	'Return the Drawing Document 
	Return oDrawDoc

End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2023 19:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/my-ilogic-code-can-t-run-it-got-the-following-error-i-hope-the/m-p/12088449#M21618</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-07-08T19:27:26Z</dc:date>
    </item>
  </channel>
</rss>

