AutoCAD Electrical General

Reply
Contributor
Nicolas.L
Posts: 13
Registered: ‎12-05-2012
Message 1 of 3 (356 Views)

[VBA] Adding a drawing to a project folder

356 Views, 2 Replies
12-19-2012 02:54 AM

Hello,

 

Is someone know the command to add the activate drawing to the project ?

 

My problem is that, I am generating various drawing and I would like to add them to a project, If someone know how to do that, It can help me.

 

ei:

 

Sub test2()

Dim AcadObj As AcadApplication
Dim AcadDoc As AcadDocument

 

On Error Resume Next
Set AcadObj = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then
    Set AcadObj = CreateObject("AutoCAD.Application")
    NombreDessinAutocad = 2
End If
AcadObj.Visible = True
 

Set AcadDoc = AcadObj.Application.Documents.Add("C:\PATH\Cartouche_V1.0.dwt")

Set AcadUtil = AcadDoc.Utility
Set AcadEspaceObj = AcadDoc.ModelSpace
 
Set blockRefObj = AcadEspaceObj.InsertBlock(P, "C:\PATH\Mop_V1.1.dwg", 1#, 1#, 1#, 0)
document to the project

 

Set ...... **Looking for the command to add my drawing to the project**

 
End Sub

 

Regards

 

Nico

Valued Contributor
metal_pro2
Posts: 66
Registered: ‎07-04-2007
Message 2 of 3 (341 Views)

Re: [VBA] Adding a drawing to a project folder

12-20-2012 09:53 AM in reply to: Nicolas.L

I could not find any type of command to add a drawing to the project like you are looking for however you could just write some code to add the information to the project.wdp file. Its just a text file so its shouldn't be to difficult. You could also add some other info like Descriptions and Section or Subsection. Its in this format

 

=section
==subsection
===description 1
===description 2
===description 3
test.dwg

 

I use notepad to edit the ".wdp" file when I need to add lots of drawings with section and description information quickly.

You need to close the project before doing this and I always make backups of the file before changing things just in case! 

*Expert Elite*
rhesusminus
Posts: 899
Registered: ‎09-21-2007
Message 3 of 3 (233 Views)

Re: [VBA] Adding a drawing to a project folder

01-14-2013 10:50 PM in reply to: Nicolas.L

Hi Nico.

 

You should search for the VLAX-class that makes it easy for VBA to communicate with LISP, as the AcadE API is solely based on AutoLISP.

Then you should have a look in the help file.

Look for c:ace_add_dwg_to_project

 

 


THL
Please select "Accept As Solution" if this post answers your question. Kudos don't hurt either. ;-)

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