<?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: Problem with DATATYPE VARIANT in AutoCAD with using VB.NET in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5753773#M39179</link>
    <description>&lt;P&gt;Alfred, thank you for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Aug 2015 09:43:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-03T09:43:50Z</dc:date>
    <item>
      <title>Problem with DATATYPE VARIANT in AutoCAD with using VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5741338#M39175</link>
      <description>&lt;P&gt;I have to plot the layout using &lt;STRONG&gt;SetLayoutsToPlot&lt;/STRONG&gt; Method using VB.NET. But I getting one error with Data Type - VARIANT. I found the help page in acadauto.chm there was this text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;object.SetLayoutsToPlot (layoutList) 

Object

Plot
The object or objects this method applies to. 

layoutList

Variant; input-only
An array of layout names representing the layouts to plot. 

Remarks 

This method may become obsolete and may be removed in a future version of AutoCAD. 

If the layoutList parameter is NULL or this method is not called at all, the active layout is sent to the plot. 

After each call to the PlotToFile or PlotToDevice method, the default layout to plot is reset to the active layout. To specify any layout other than the active layout, you must call the SetLayoutsToPlot method before each plot.&lt;/PRE&gt;&lt;P&gt;The problem is that I'm haven't the Data Type 'Variant' in VB.NET. I have only Data Type 'Object'. And this method is doesn't work! But I need to use that method.&lt;/P&gt;&lt;P&gt;Please, tell me how could I to get solution by this problem.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 06:48:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5741338#M39175</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-27T06:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with DATATYPE VARIANT in AutoCAD with using VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5741426#M39176</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you are correct, datatype "Variant" is only defined within VBA, but not within VB.NET.&lt;/P&gt;
&lt;P&gt;So you can use in VB.NET the type "Object" instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us your source code so we see what is not working when you use "Object" instead of "Variant".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- alfred -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW: there is a special forum for AutoCAD and .NET &lt;A href="https://forums.autodesk.com/t5/net/bd-p/152" target="_self"&gt;&amp;gt;&amp;gt;&amp;gt;there&amp;lt;&amp;lt;&amp;lt;&lt;/A&gt; (if the admin not already moved this thread to that forum &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; )&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 08:54:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5741426#M39176</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2015-07-27T08:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with DATATYPE VARIANT in AutoCAD with using VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5741468#M39177</link>
      <description>&lt;P&gt;Thanks for answer Alfred &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code before:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Private Function FORCIBLY_AUTOCAD_TO_PDF_BY_ONE_BY_LAYOUTS()

        ' Принудительно печатаем листы, если пакетная печать не удалась

        Dim acad As Object
        Dim TextLine As String
        Dim LayoutParameters() As String
        ReDim LayoutParameters(1000)
        Dim N As Integer
        Dim LayP As Object
        Dim Need_Path_Name As String
        Dim PDF_File_Name As String

        Dim Layout_Names(0) As String
        Dim LrsToPlot As Object

        N = -1


        FileOpen(1, Me.Plot_File, OpenMode.Input)
        Do While Not EOF(1)
            TextLine = LineInput(1)
            If InStr(TextLine, "ЛИСТ") &amp;lt;&amp;gt; 0 Then
                N = N + 1
                LayoutParameters(N) = TextLine
            End If
        Loop
        FileClose(1)

        ReDim Preserve LayoutParameters(N)


            acad = CreateObject("Autocad.Application")

            Do While acad.Documents.Count &amp;gt; 0
                acad.Documents(0).Close(False)
            Loop

            Need_Path_Name = Me.DWG_Dir &amp;amp; "\" &amp;amp; Me.File_Name_Without_Extension &amp;amp; ".dwg"
            acad.Documents.Open(Need_Path_Name)


            For i = LBound(LayoutParameters) To UBound(LayoutParameters)
                LayP = Split(LayoutParameters(i), " | ")

                PDF_File_Name = Me.PDF_Dir &amp;amp; "\" &amp;amp; LayP(1) &amp;amp; ".pdf"
                acad.ActiveDocument.SendCommand("_filedia" &amp;amp; vbCr &amp;amp; "0" &amp;amp; vbCr)
                acad.ActiveDocument.SendCommand("_cmddia" &amp;amp; vbCr &amp;amp; "0" &amp;amp; vbCr)

                Layout_Names(0) = LayP(1)
                LrsToPlot = Layout_Names
                
&lt;STRONG&gt;                ' This fragment of code doesn't work
                acad.ActiveDocument.Plot.SetLayoutToPlot (LrsToPlot)   ' &amp;lt;---- ERROR, Because it's OBJECT
                acad.Plot.PlotToFile(PDF_File_Name, "DWG_To_PDF_Gallurgy.pc3")
                ' End fragment of code&lt;/STRONG&gt;


                    Do While acad.GetAcadState.IsQuiescent = False
                        If acad.GetAcadState.IsQuiescent = True Then
                            Exit Do
                        End If
                    Loop

            Next i

        acad.Visible = False

            Do While acad.Documents.Count &amp;gt; 0
                acad.Documents(0).Close(False)
            Loop

        acad = Nothing

        FORCIBLY_AUTOCAD_TO_PDF_BY_ONE_BY_LAYOUTS = "Пакетная печать на отдельные листы - завершена!"


    End Function&lt;/PRE&gt;&lt;P&gt;Now I found the solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I replace errored fragment on to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                acad.ActiveDocument.SendCommand("_-layout" &amp;amp; vbCr &amp;amp; "_set" &amp;amp; vbCr &amp;amp; LayP(1) &amp;amp; vbCr)

                acad.ActiveDocument.SendCommand("_-plot" &amp;amp; vbCr &amp;amp; "_N" &amp;amp; vbCr &amp;amp; LayP(1) &amp;amp; vbCr &amp;amp; "" &amp;amp; vbCr &amp;amp; "DWG_To_PDF_Gallurgy.pc3" &amp;amp; vbCr &amp;amp; _
                                                Me.PDF_Dir &amp;amp; "\" &amp;amp; LayP(1) &amp;amp; ".pdf" &amp;amp; vbCr &amp;amp; "_N" &amp;amp; vbCr &amp;amp; "_Y" &amp;amp; vbCr)&lt;/PRE&gt;&lt;P&gt;It's work!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to print invisible! But I didn't get: print window is still open!&amp;nbsp;That is enough for a while.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 09:31:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5741468#M39177</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-27T09:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with DATATYPE VARIANT in AutoCAD with using VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5743233#M39178</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for your first issue you might try to change the line to that syntax:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#333333"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acad.ActiveDocument.Plot.SetLayoutsToPlot(&lt;STRONG&gt;&lt;FONT color="#000080"&gt;CObj(&lt;/FONT&gt;&lt;/STRONG&gt;LrsToPlot&lt;STRONG&gt;&lt;FONT color="#000080"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;)&amp;nbsp;&amp;nbsp; ' &amp;lt;---- ERROR, Because it's OBJECT&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would avoid to use .SendCommand as much as possible because you don't get a feedback when something went wrong in the commandline.&lt;/P&gt;
&lt;P&gt;So you can also change the sysvar setting to something like that:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#333333"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acad.ActiveDocument.SetVariable("FILEDIA", 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#333333"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acad.ActiveDocument.SetVariable("CMDDIA", 0)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080"&gt;&lt;EM&gt;&amp;gt;&amp;gt; I'm trying to print invisible! But I didn't get: print window is still open!&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The systemvariable for printing in background is BACKGROUNDPLOT, you can play with activating it. But you should know that your code then will not wait the end of the plot and continues to run, that often ends in some strange results, so change that only if you really need it and only if your code is really safe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH, - alfred -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 18:03:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5743233#M39178</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2015-07-27T18:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with DATATYPE VARIANT in AutoCAD with using VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5753773#M39179</link>
      <description>&lt;P&gt;Alfred, thank you for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 09:43:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-datatype-variant-in-autocad-with-using-vb-net/m-p/5753773#M39179</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-03T09:43:50Z</dc:date>
    </item>
  </channel>
</rss>

