<?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: Civil3d and vb.net in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769324#M80345</link>
    <description>Yeah, i know what you mean.  I taught myself to program in VBA and it's really not all that difficult.  Now I've joined the .NET world, and i feel like i'm re-learning the basics.  But it seems worth it to learn the Managed API's because you can do so much more... Create custom tool palletes, custom tabs in the AutoCAD options menu, and i can use the JIG function..&lt;BR /&gt;
.NET programs definitely feel more like an extension of AutoCAD than VBA/COM programs do.  However it takes about 20 lines of code to do the same thing as 4 lines of code in COM&lt;BR /&gt;
&lt;BR /&gt;
I'm not quite sure about performance speed.  I think that using COM in VB is slightly faster than VBA.  And .NET is only slightly slower than ObjectARX&lt;BR /&gt;
&lt;BR /&gt;
check out this post, there is a graph and some comments.  i think the graph is slightly misleading though... &lt;BR /&gt;
&lt;BR /&gt;
http://discussion.autodesk.com/thread.jspa?messageID=5312479&lt;BR /&gt;
&lt;BR /&gt;
i believe the order is as follows:&lt;BR /&gt;
-ObjectARX&lt;BR /&gt;
-.NET (Managed API)&lt;BR /&gt;
-.NET (COM)&lt;BR /&gt;
-VBA (COM)&lt;BR /&gt;
-VLISP</description>
    <pubDate>Wed, 20 Sep 2006 19:52:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-09-20T19:52:24Z</dc:date>
    <item>
      <title>Civil3d and vb.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769319#M80340</link>
      <description>I'm having problems with a managed vb.net project and civil3d.&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to create a basic routine that manipulates layers.&lt;BR /&gt;
&lt;BR /&gt;
I've referenced the acmgd and acdbmgd dll's follow a sample from an AU 2005 handout.&lt;BR /&gt;
&lt;BR /&gt;
vb.net is not recognizing the Import namespaces from the sample.&lt;BR /&gt;
&lt;BR /&gt;
I tried starting with a vb.net sample from the ARX SDK and the namespaces are recognized and I can run the dll in Civil3D and get my dialog box to come up.&lt;BR /&gt;
&lt;BR /&gt;
The next issue I have ran into is that acadlayer is not recognized in the vb.net and isn't showing up in a search for it in  the object explorer model explorer.&lt;BR /&gt;
&lt;BR /&gt;
Are there any issues with creating a managed .net app with civil3d or are there issues with my code.&lt;BR /&gt;
&lt;BR /&gt;
thanks in advance.</description>
      <pubDate>Wed, 20 Sep 2006 14:40:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769319#M80340</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-20T14:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Civil3d and vb.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769320#M80341</link>
      <description>Hi Scott,&lt;BR /&gt;
I beleive you have to access the layers via the layertable object.  When you access the record, just like you would access the blocktable, you can pass a name to the program and get back an LayerId.  Then you can use that layerID to set a layertablerecord to the specified layer.  After that you i believe you can manipulate the object like it was an AcadLayer object.&lt;BR /&gt;
&lt;BR /&gt;
here is some code from one of the labs in the .Net training.&lt;BR /&gt;
&lt;BR /&gt;
 Private Function CreateLayer() As ObjectId&lt;BR /&gt;
        Dim layerId As ObjectId 'the return value for this function&lt;BR /&gt;
        Dim db As Database = HostApplicationServices.WorkingDatabase&lt;BR /&gt;
        Using trans As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;
            'Get the layer table first, open for read as it may already be there&lt;BR /&gt;
            Dim lt As LayerTable = trans.GetObject(db.LayerTableId, OpenMode.ForRead)&lt;BR /&gt;
&lt;BR /&gt;
            'Check if EmployeeLayer exists...&lt;BR /&gt;
            If lt.Has("EmployeeLayer") Then&lt;BR /&gt;
                layerId = lt.Item("EmployeeLayer")&lt;BR /&gt;
            Else&lt;BR /&gt;
                'If not, create the layer here.&lt;BR /&gt;
                Dim ltr As LayerTableRecord = New LayerTableRecord()&lt;BR /&gt;
                ltr.Name = "EmployeeLayer" ' Set the layer name&lt;BR /&gt;
                ltr.Color = Color.FromColorIndex(ColorMethod.ByAci, 2)&lt;BR /&gt;
                ' it doesn't exist so add it, but first upgrade the open to write&lt;BR /&gt;
                lt.UpgradeOpen()&lt;BR /&gt;
                layerId = lt.Add(ltr)&lt;BR /&gt;
                trans.AddNewlyCreatedDBObject(ltr, True)&lt;BR /&gt;
            End If&lt;BR /&gt;
            trans.Commit()&lt;BR /&gt;
        End Using&lt;BR /&gt;
&lt;BR /&gt;
        Return layerId&lt;BR /&gt;
    End Function&lt;BR /&gt;
&lt;BR /&gt;
Hope that helps.  Definitely a lot of code involved to set a layer!</description>
      <pubDate>Wed, 20 Sep 2006 17:34:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769320#M80341</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-20T17:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Civil3d and vb.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769321#M80342</link>
      <description>Thanks cadkid, I was hoping to be able to use something from this post:&lt;BR /&gt;
&lt;BR /&gt;
http://discussion.autodesk.com/thread.jspa?messageID=5187189&lt;BR /&gt;
&lt;BR /&gt;
 Dim NewLayer As AcadLayer&lt;BR /&gt;
&lt;BR /&gt;
NewLayer = acadDoc.Layers.Add("Layer1")&lt;BR /&gt;
&lt;BR /&gt;
NewLayer.TrueColor.SetRGB(255, 0, 0)</description>
      <pubDate>Wed, 20 Sep 2006 18:01:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769321#M80342</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-20T18:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Civil3d and vb.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769322#M80343</link>
      <description>No problem.  You should be able to reference the COM interface of AutoCAD even though you are using Civil3D.&lt;BR /&gt;
&lt;BR /&gt;
First make sure you have a reference set to the following under the COM tab, in references&lt;BR /&gt;
"AutoCAD 2006 Type Library"&lt;BR /&gt;
"AutoCAD/Object DBX Common 16.0 Library"&lt;BR /&gt;
&lt;BR /&gt;
then use the Imports Autodesk.AutoCad.Interop.Common statement at the beginning of your code.&lt;BR /&gt;
&lt;BR /&gt;
Then you should be able to use the line:&lt;BR /&gt;
&lt;BR /&gt;
"Dim NewLayer as AcadLayer"&lt;BR /&gt;
&lt;BR /&gt;
Let me know if that works.&lt;BR /&gt;
&lt;BR /&gt;
-Mark P</description>
      <pubDate>Wed, 20 Sep 2006 18:18:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769322#M80343</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-20T18:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Civil3d and vb.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769323#M80344</link>
      <description>ahhhhhhhhh . . . now it makes sense.&lt;BR /&gt;
&lt;BR /&gt;
I didn't realize the mgd .net object model was that different from the COM model.&lt;BR /&gt;
&lt;BR /&gt;
What kind of performance difference is there between COM and the .net mgd code?</description>
      <pubDate>Wed, 20 Sep 2006 19:34:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769323#M80344</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-20T19:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Civil3d and vb.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769324#M80345</link>
      <description>Yeah, i know what you mean.  I taught myself to program in VBA and it's really not all that difficult.  Now I've joined the .NET world, and i feel like i'm re-learning the basics.  But it seems worth it to learn the Managed API's because you can do so much more... Create custom tool palletes, custom tabs in the AutoCAD options menu, and i can use the JIG function..&lt;BR /&gt;
.NET programs definitely feel more like an extension of AutoCAD than VBA/COM programs do.  However it takes about 20 lines of code to do the same thing as 4 lines of code in COM&lt;BR /&gt;
&lt;BR /&gt;
I'm not quite sure about performance speed.  I think that using COM in VB is slightly faster than VBA.  And .NET is only slightly slower than ObjectARX&lt;BR /&gt;
&lt;BR /&gt;
check out this post, there is a graph and some comments.  i think the graph is slightly misleading though... &lt;BR /&gt;
&lt;BR /&gt;
http://discussion.autodesk.com/thread.jspa?messageID=5312479&lt;BR /&gt;
&lt;BR /&gt;
i believe the order is as follows:&lt;BR /&gt;
-ObjectARX&lt;BR /&gt;
-.NET (Managed API)&lt;BR /&gt;
-.NET (COM)&lt;BR /&gt;
-VBA (COM)&lt;BR /&gt;
-VLISP</description>
      <pubDate>Wed, 20 Sep 2006 19:52:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/civil3d-and-vb-net/m-p/1769324#M80345</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-20T19:52:24Z</dc:date>
    </item>
  </channel>
</rss>

