I encounter a problem that I do not understand. I created a little C# routine for Autocad Electrical (2011 and 2012) which adds some drawings to the current project with the following command:
This mehtod works perfectly. With the parameter list you can set the Section, Sub-Section and Descriptions of the page properties, exactly what I want.
When I start the routine, I check which project is active. If the wrong project is active, I activate the appropiate project with the following command:
So, when I want to add drawings to project A and project B is active at the start of the routine, I activate project A and the drawings are added.
When I want to add drawings to project A and this project is already active, the drawings are not added to the project. The method mentioned above to add drawings returns nill, which means a failure.
Why is this happening? Is this a bug of Autocad?
I already tried to always activate the project I want to add drawings to, but that doensn't matter.
Can anyone help me with this problem?
Thanks in advance.
Solved! Go to Solution.
This API added the drawing to the active project for me. I was just using lisp to try it. What version of AutoCAD Electrical are you using this on? Also, can you provide what values you are putting in the paramlst?
This problem occurs in Autocad Electrical 2011, but also in 2012. I didn't try 2013 and 2014 yet.
Values I use in the parameter list:
(list "4" "6" (list "" "HOOFDSTROOM" "MCC1") nil)
As said before, this works perfectly for me. But it only works when I start with project A and first have to activate project B, because I want to add the drawing to project B. If project B already is the active project, is doesn't work.
Are there any other options to add drawings to a project? (beside hacking the .wdp file)
The call worked as expected for me in AutoCAD Electrical 2012.
Here is my lisp call that I typed on the command line -
(c:ace_add_dwg_to_project "C:\\USERS\\MURNENP\\DOCUMENTS\\ACADE 2012\\AEDATA\\PROJ\\DEMO\\DEMO04.DWG" (list "4" "6" (list "" "HOOFDSTROOM" "MCC1") nil))
Can you try typing your call on the command line like this to see if it works? Since yours is wrapped in another call I am just trying to narrow down where it is failing.
By the way, the drawing is always added at the bottom of the list.
Typing my call on the command line works fine, but after I run my .dll it doesn't work anymore. So it looks like I do some actions in my .dll file which prevents me from adding files to the active project.
I solved this problem with the following command:
I don't exactly know what this command do, but I think it's kind of a refresh of the project. Using this command each time before adding a drawing to the project solves the problem.
I thought is was enough to use this command once, but it wasn't.
Yes, it is a refresh of a few things project related. Probably the most important one is that it calls the API
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.
The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.
Upgrading to a 2015 product? Make sure to check these out 1st!