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

Visual Lisp functions and namespaces?

7 REPLIES 7
Reply
Message 1 of 8
coopdetat
460 Views, 7 Replies

Visual Lisp functions and namespaces?

In the past I've exclusively work with SDI =1 (one drawing open at a time). Now that I have adopted Sheet Sets as a standard tool I use, I have also made a foray into using SDI=0 (more than one drawing open at a time). I am seeing some new errors or general misbehavior of AutoCAD lately, especially when I am in VLIDE. They don't explicitly identify namespace confusion as the problem but it seems that it might be part of it.

 

QUESTION:
Must I explicitly identify the associated namespace when making visual Lisp function calls (VL*, VLA*, VLAX*), and if so how is that done?

 

Any insight into the working of namespaces would be greatly appreciated.

 

Thanks!

---------------------------------------------Signature--------------------------------------------
Civil Design Professional Since 1983 (Intergraph), AutoCAD since 1989

Windows 10 Pro 64-bit Intel﴾R﴿ Core﴾TM﴿ i9-12900KF CPU 3.19GHz; 32 GB DDR4 4266 Dual Channel RAM
nVidia Quadro RTX 4000; AutoCAD Civil 3D 2023.2.1 Update
7 REPLIES 7
Message 2 of 8

I would ask this question in the general AutoCAD LISP discussion group. There is a better chance that it will get answered. Very few people (myself included) use LISP on a reqular basis with Civil 3D (if you are - stop).

 

Cheers,

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

Message 3 of 8

Well... Peter,

Are you speaking for Autodesk officially when you tell me to stop using autolisp with C3D or is that advice your own and independent of the official Autodesk position?

 

Since you were motivated to tell me ""(If you are - stop)" perhaps you can find the motivation to provide the reason for that, i.e. "(If I am, why should I - stop?)".  Not that I think you need to know before you can be of any help, but, I use autolisp with C3D because I have used essentially the same autolisp with every Land product since before it was Autodesk (it was DCA).  I have made modifications and additions over the years but I have not even begun to try to learn .NET and completely rewrite my key software (it is now over 2.5MB of code including comments), I just lately had to break it into two separate lisp files.  I learned by unhappy experience that exceding a 2.5MB file size while in VLIDE will instantly crash AutoCAD.

 

Anyway, since it is all but impossible to use "just" AutoCAD when the only license available to me is for C3D, I post in the C3D area.  Whatever I do is impacted by how C3D functions, and AutoCAD may not respond exactly the same where plain AutoCAD is in use.  I am having some trouble with C3D 2013 and have yet to nail down the source.  It may not even be an autolisp problem.  It may even be a problem with my system (PC).  The variables increase for me because I have begun using SDI=0 in conjunction with Sheet Sets.  I am just trying to eliminate whatever I can as a source of the not very well defined issues that have appeared since I began using C3D 2013 exclusively.

 

Finally, if you have any useful knowledge on the subject (the subject of my op), wouldn't it be better to share that knowledge than to assume you know why I am asking and chide me based upon that assumption?

 

---------------------------------------------Signature--------------------------------------------
Civil Design Professional Since 1983 (Intergraph), AutoCAD since 1989

Windows 10 Pro 64-bit Intel﴾R﴿ Core﴾TM﴿ i9-12900KF CPU 3.19GHz; 32 GB DDR4 4266 Dual Channel RAM
nVidia Quadro RTX 4000; AutoCAD Civil 3D 2023.2.1 Update
Message 4 of 8
Jeff_M
in reply to: coopdetat

I'm not Peter, and I do still occassionally use lisp with C3D. But, in part due to Peter's urging, I have moved on to doing most of my customizing using the .NET lanuages (c# is my primary choice). Peter has been saying for 5-6 years now that lisp is not a good option for customizing C3D. And, for the most part, I now agree.

 

Reasoning for this is based on a number of things:

Compared to .NET, lisp is slooooowwwwww.

While C3D does have a COM API, I have found a number of properties/methods that refuse to return correct values, or none at all.

Many of the new objects, methods, and properties introduced with each new release are available in .NET only.

Working across mutiple drawings is pretty simple with .NET (compared to lisp anyway).

I'm sure there are other reasons, that's all I'm coming up with right now.

 

As for your immediate issues with lisp, what errors are you seeing? Lisp is designed to work with the current drawing only, no matter how many drawings you have open. (Unless you introduce ObjectDBX, but that's a whole other can o worms.) There are ways to use variables across drawings, but in all my years of lisping, I've never needed to use them. Post some code which is giving you problems and we may be able to see fairly quickly what may be causing the problem(s).

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 8
coopdetat
in reply to: Jeff_M

I can't even remember exactly what happened but it seemed like things that should have been isolated to one drawing were being mingled with others but there was no proof of that.  Before that, I had some serious crashing problems where these old venerable routines would crash if I closed a nested dialog.  My typical method is to dismiss both the nested dialog and the primary dialog with code that runs after (DONE_DIALOG) in the nested one.  It had been working flawlessly for over a decade so I was a bit surprised by the sudden onset of major fatalities that were reproduceable by dismissing any of my nested dialogs.  I finally figured out that I had a memory configuration problem with my system.  (that's another long story) It is a dual Xeon EVGA Classified-SR2 system.  It was supposed to have 32GB of RAM but it showed only 24GB at the time of the ptoblem.  When the proverbial smoke cleared I had a stable 16GB Dual Channel configuration.

 

I'm not having a problem with any code.  I'm having a problem with AutoCAD's stability (or lack thereof).  It is not just my programs.  I'm thinking now that my Dragon Naturally Speaking Professional may not be working and playing well with others.  The only reason I have Dragon is to use with AutoCAD.  Sometimes AutoCAD slows down to a crawl... without my programs running.  It hangs upon exit often and has to have its process killed.  I just figured that a dual Xeaon machine with 16GB of RAM should not be going slower than the single Xeon with 8GB RAM that I was using until about 6 weeks ago

 

Sometimes it is blisteringly fast... just as I expect it to be.

 

If the news would be that namespaces were an issue I must address when using SDI-0 then I would just go back to SDI=1.  I prefer it anyway.

---------------------------------------------Signature--------------------------------------------
Civil Design Professional Since 1983 (Intergraph), AutoCAD since 1989

Windows 10 Pro 64-bit Intel﴾R﴿ Core﴾TM﴿ i9-12900KF CPU 3.19GHz; 32 GB DDR4 4266 Dual Channel RAM
nVidia Quadro RTX 4000; AutoCAD Civil 3D 2023.2.1 Update
Message 6 of 8

Part 1:

My suggestion for your OP was, and is, to repost in it the Visual Lisp newsgroup. From the sounds of the issue it has nothing to do with Civil 3D and is a general AutoCAD LISP question. You will find people that would have a suggestions on what to do there.

 

Part 2:

If you are just working with AutoCAD entities, views, layers, etc. then use what whatever programming language you think works best, and stop reading here.

 

Part 3:

Jeff did a good summary of the reasons not to use LISP to program with in Civil 3D. The main reasons I tell people not to use LISP is that it uses the old and slow COM API from Civil 3D that we stopped working on years ago when we focused on .NET, coupled with a programming UI that is little better than Notepad. There are so many better choices out there that provide a much richer programming environment.

 

Regards,

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

Message 7 of 8

Thanks Peter,

 

I gather that rather than an official Autodesk position it is your expert recommendation. I'll take it to heart.  I need to know where I can get some quality instruction on C# and .NET since I am monolingual at this point.

 

I really don't do much more than get at the AECC custom entities in a way I can understand and manipulate.  I haven't ever really followed the typical AutoCAD methods for doing things anyway.  In my formative years, when I would ask "how do you..." about something I wanted to do in AutoCAD that I had been doing in Intergraph/MicroStation, I would invariably get "Why would you want to do that?" as an answer.  Thanks to the excelent advice and encouragement of Kanwar Anand, an instructor at Ketiv Technologies way back then (He's now the owner I think) I was able to do what I wanted by learning and using AutoLisp.  I had Visual Lisp from Basis Software to do my coding in and was a happy camper... well, until Autodesk bought it and removed its ability to operate as a stand-alone application anyway.  BTW, AutoCAD now includes many of the things I had asked about, which Intergraph/Microstation did and which were so foreign to the minds of AutoCAD users back then.

 

I have been watching the AutoCAD C3D process performance graph on my PC (using Process Explorer from Microsoft) and I've turned up what is likely the real problem.  AutoCAD starts up using about 500 MB of private memory bytes.  It adds to this as the workflow progresses until it reaches about 1.2 GB.  I haven't ever seen it go much more than 1.2 GB.  Around that level the performance that I can see without Process Explorer is visibly degraded and that is when the strange things usually start happening.  If I use multiple Sheet Sets, SDI=0, and open on several drawings at the same time the private bytes hit this performance threshold pretty quickly.  The only solution I have found is to close AutoCAD and reopen it.  Strangely, when I do, the private bytes used is about 100 MB less than it was at the initial startup.

 

---------------------------------------------Signature--------------------------------------------
Civil Design Professional Since 1983 (Intergraph), AutoCAD since 1989

Windows 10 Pro 64-bit Intel﴾R﴿ Core﴾TM﴿ i9-12900KF CPU 3.19GHz; 32 GB DDR4 4266 Dual Channel RAM
nVidia Quadro RTX 4000; AutoCAD Civil 3D 2023.2.1 Update
Message 8 of 8

The "official word" processed by Marketing and the Legal departments might be "AutoCAD Civil 3D has many APIs that can be used to customize the application, and customers are free to choose the one that works best for them".

 

What I'm giving is the word from the software engineering team that know the products, know the APIs, works with other external developers and knows the direction that we are moving development of the APIs. This is also what we tell other external developers when we talk with them: use .NET to customize Civil 3D.

 

Regards,

 

Peter Funk

Autodesk, Inc.

 

 



Peter Funk
Autodesk, Inc.

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

Post to forums  

Rail Community


Autodesk Design & Make Report