AutoCAD Electrical General

Reply
Active Contributor
110000474593
Posts: 29
Registered: ‎09-24-2012
Message 1 of 6 (513 Views)
Accepted Solution

Add drawings to active project

513 Views, 5 Replies
12-04-2013 12:35 AM

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.

 

 

Employee
murnenp
Posts: 522
Registered: ‎08-01-2007
Message 2 of 6 (490 Views)

Re: Add drawings to active project

12-04-2013 08:12 AM in reply to: 110000474593

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

 



Pat Murnen
Principal Content Developer
Information Modeling and Platform Products Group

Autodesk, Inc.

Active Contributor
110000474593
Posts: 29
Registered: ‎09-24-2012
Message 3 of 6 (470 Views)

Re: Add drawings to active project

12-05-2013 12:43 AM in reply to: murnenp

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)

Employee
murnenp
Posts: 522
Registered: ‎08-01-2007
Message 4 of 6 (460 Views)

Re: Add drawings to active project

12-05-2013 06:20 AM in reply to: 110000474593

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.



Pat Murnen
Principal Content Developer
Information Modeling and Platform Products Group

Autodesk, Inc.

Active Contributor
110000474593
Posts: 29
Registered: ‎09-24-2012
Message 5 of 6 (398 Views)

Re: Add drawings to active project

12-09-2013 12:22 AM in reply to: murnenp

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.

 

 

Employee
murnenp
Posts: 522
Registered: ‎08-01-2007
Message 6 of 6 (388 Views)

Re: Add drawings to active project

12-09-2013 05:35 AM in reply to: 110000474593

Yes, it is a refresh of a few things project related. Probably the most important one is that it calls the API

wd_mdb2_upd_prj_ixlst which freshens the drawing list and related information like descriptions, etc. in memory.
 
It looks like since you had also posted in the developer forum the case was escalated. If you consider this fixed you may want to post there so they know it is resolved.
 
Regards,
Pat


Pat Murnen
Principal Content Developer
Information Modeling and Platform Products Group

Autodesk, Inc.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Electrical Category!

The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.

Ask the Community