AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Circuit Builder with non-API VB.NET Command

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jmoura2009
850 Views, 3 Replies

Circuit Builder with non-API VB.NET Command

Does any know if it is possible to reference/run a dotNet created command within the circuit builder XLS.

 

For example I compile the following command with VB.net called "MyCommand"

       <CommandMethod("MyGroup", "MyCommand", "MyCommandLocal", CommandFlags.Modal)> _
        Public Sub MyCommand() ' This method can have any name
            Dim acadMText As MText
            Dim acadBT As BlockTable
            Dim acadBTR As BlockTableRecord
            Dim acadDB As Database = HostApplicationServices.WorkingDatabase
            Dim acadTrans As Transaction
            acadTrans = acadDB.TransactionManager.StartTransaction()
            Try
                acadBT = acadTrans.GetObject(acadDB.BlockTableId, _
                  Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead)
                acadBTR = acadTrans.GetObject(acadBT(acadBTR.ModelSpace), _
                  Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite)
                acadMText = New MText()
                acadMText.Contents = "Hello World!!"
                acadBTR.AppendEntity(acadMText)
                acadTrans.AddNewlyCreatedDBObject(acadMText, True)
                acadTrans.Commit()
            Catch
                acadTrans.Abort()
            Finally
                If Not IsNothing(acadTrans) Then acadTrans.Dispose()
                If Not IsNothing(acadMText) Then acadMText.Dispose()
                If Not IsNothing(acadBT) Then acadBT.Dispose()
                If Not IsNothing(acadDB) Then acadDB.Dispose()
            End Try
        End Sub

 

 

 

From the command line, it run and adds the simple "Hello World" text to my drawings. 

hw.jpg

 

 

Next I wanted to add a command (a little more complex than HelloWorld) to my Circuit Builder XLS sheet to execute when needed.  However I'm unsure how to make this happen.  I'm tried the following CommandLists but nothing happen.

 

test.jpg

 

Any help would be appreciated.

 

Joe

3 REPLIES 3
Message 2 of 4
PatMurnen_Adsk
in reply to: jmoura2009

Joe,

 

I would like to experiment with this if you could send me the compiled sample file. My direct email is pat.murnen@autodesk.com

 

Regards,

Pat



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

Message 3 of 4

It looks like the syntax -

 

(c:ace_cb_eval "(command 'mycommand')")

 

should work. It basically embeds the command in the lisp call.

 

Regards,

Pat



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

Message 4 of 4
jmoura2009
in reply to: PatMurnen_Adsk

Thank you Pat.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost