Hello everyone,
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:
(c:ace_add_dwg_to_project dwg2add paramlst)
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:
(c:wd_makeproj_current wdpfnam)
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.
The problem:
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?
Regards,
Pat Murnen
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:
(c:ace_wdp_reread)
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
Autocad Electrical Issue :
I cannot add new drawings in a Active Project, a message appears in the command bar :
Failed to demand load: wdcpyprj
Function: (WD_CPYPRJ_CHK4_RELATED_FILES A B)
Failed to demand load: wdupda
Someone knows how to fix this issue ?
I´ll appreciate a lot your help ¡
I've had exactly the same issue with AcadE 2021
c:ace_wdp_reread no longer exists,
I had to use c:wd_mdb_freshen_noask instead which solves the problem
Can't find what you're looking for? Ask the community or share your knowledge.