.NET

.NET

Reply
Contributor
mostafabadran
Posts: 15
Registered: ‎10-31-2013
Message 1 of 7 (967 Views)
Accepted Solution

Creating a partial CUI,lisp file and loading it inside AutoCAD

967 Views, 6 Replies
11-19-2013 08:56 AM

Hi. I am new in customizing autocad. I want vb code that work in Visual Studio 2010 Express to create bundle to load Creating a partial CUI,lisp file and loading it inside AutoCAD 2012 .

Regards,
mostafa

Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 2 of 7 (952 Views)

Re: Creating a partial CUI,lisp file and loading it inside AutoCAD

11-19-2013 10:56 AM in reply to: mostafabadran

If I understand you correctly, you want to create a .lsp file in VB and use it to netload your plugin or do other customizations.  If yes all you need to do is overwrite yourprofile\Support\acaddoc.lsp file with something like this and then start an autocad session (it will automatically execute whatever commads you put in the startup section).  Note that if there is another autocad session running while your program changes this it, it will attempt to recompile the CUI binary and more than 1 sessions might step on each other.  You have to manage that.

 

    Private Const m_acaddoclspFile As String = "acaddoc.lsp"
    Private Const m_lspFile As String = _
                                ";;;acad.lsp is loaded once, acaddoc.lsp is loaded for each document," + vbCrLf + _
                                ";;;s::startup is called after acaddoc.lsp" + vbCrLf + _
                                ";" + vbCrLf + _
                                "(DEFUN S::STARTUP ()  " + vbCrLf + _
                                "  (setvar ""cmdecho"" 0)" + vbCrLf + _
                                "  (command ""_.netload"" ""yourdll.dll"")" + vbCrLf + _
                                "  (setvar ""cmdecho"" 1)" + vbCrLf + _
                                "  (princ)" + vbCrLf + _
                                ";;(princ "" End s::Startup\n"")" + vbCrLf + _
                                ")" + vbCrLf + _
                                 vbCrLf + _
                                ";;; end of file" + vbCrLf

 

Distinguished Mentor
BlackBox_
Posts: 745
Registered: ‎02-25-2013
Message 3 of 7 (939 Views)

Re: Creating a partial CUI,lisp file and loading it inside AutoCAD

11-19-2013 12:10 PM in reply to: mostafabadran

Must you load the CUIx, and LISP with code?

 

Why not just use an Autoloader .bundle?



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

Contributor
mostafabadran
Posts: 15
Registered: ‎10-31-2013
Message 4 of 7 (927 Views)

Re: Creating a partial CUI,lisp file and loading it inside AutoCAD

11-19-2013 01:31 PM in reply to: sszabo
thanks for your replying, my Apologies for late to reply.
sszabo. I Am not create .dll not yet I want vb code to do that. to load cui in autocad and lode lisps.
thanks
Contributor
mostafabadran
Posts: 15
Registered: ‎10-31-2013
Message 5 of 7 (927 Views)

Re: Creating a partial CUI,lisp file and loading it inside AutoCAD

11-19-2013 01:32 PM in reply to: BlackBox_
thanks for your replying, my Apologies for late to reply.
blackbox,I am new in customizing autocad. so can you explain to me once once.if you have a time how can I use an Autoloader .bundle
Distinguished Mentor
BlackBox_
Posts: 745
Registered: ‎02-25-2013
Message 6 of 7 (918 Views)

Re: Creating a partial CUI,lisp file and loading it inside AutoCAD

11-19-2013 01:54 PM in reply to: mostafabadran

mostafabadran wrote:
thanks for your replying, my Apologies for late to reply.
blackbox,I am new in customizing autocad. so can you explain to me once once.if you have a time how can I use an Autoloader .bundle

No worries; we all start somewhere.

 

First, Autoloader may not be the simplest solution, if you are new to it... It may be simpler to manually CUILOAD, and/or add a LOAD statement in your AcadDoc.lsp file, etc. (if you know how to do that?)... However, Autoloader is great at doing a few things really, really well, like automagically loading CUIx, and executable files (like LISP) as specified within the .bundle's configuration.

 

Autoloader also makes it really easy for others to load your plug-ins (even if only CUIx, and LISP)... Although they (Autodesk) could make it even simpler if they'd allow for .bundles to be placed on the network instead of relegating to %AppData%, etc. (but that's another topic altogether).

 

To learn more about Autoloader, see the 'Autoloader White Paper' link in my signature - I reference this often, especially when first learning about the Autoloader mechanism.

 

In the short term, perhaps you could post your CUIx, and LISP, and I can help by setting up an Autoloader .bundle for you, that you can test out, and refine on your end.

 

Cheers



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

Contributor
mostafabadran
Posts: 15
Registered: ‎10-31-2013
Message 7 of 7 (912 Views)

Re: Creating a partial CUI,lisp file and loading it inside AutoCAD

11-19-2013 02:16 PM in reply to: BlackBox_
Thank you so much, that gives me the honor to take a look at my cui and lisp.
thank you for your positive reply, i will post my cui and lisp to take a look at them.
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.