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

[VBA] Adding a drawing to a project folder

2 REPLIES 2
Reply
Message 1 of 3
Nicolas.L
659 Views, 2 Replies

[VBA] Adding a drawing to a project folder

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

2 REPLIES 2
Message 2 of 3
metal_pro2
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! 

Message 3 of 3
rhesusminus
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

 

 


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉

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

Post to forums  

”Boost