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: 

Automaticly generate my electrical schema from .xls data

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

Automaticly generate my electrical schema from .xls data

Hello eveyone,

 

I am new in Autocad Electrical 2013 and i am trying to automatism my work.

 

After a quick look on the others topics i do not found the answers of my problem.

 

I have thought of first create a base for my entire project in .dwt

Then realize different .dwg like a library

The last thing is using VBA and a excel sheet to import only the items i need.

 

My questions are : Is it the good way to do ?

                               Is someone able to tell me how i can import in a .dwg another one like a block (in VBA) ?

I have tried this :

 

Sub Test_Insert()
Dim pts(0 To 2) As Double
pts(0) = 20: pts(1) = 20: pts(2) = 0
ThisDrawing.Blocks.Add(pts,"C:\path\file1.dwg")
End Sub

 

Of course it is not working 🙂

 

If someone can help, having example or answer or anything else which can help, I will be great full.

 

Thanks by advance

 

Regards

 

Nicolas

 

Ps: Sry for my frenchy English

 

2 REPLIES 2
Message 2 of 3
rhesusminus
in reply to: Nicolas.L

To answer your VBA-question.

 

You are trying to add a new block to the drawings block-library.

To insert a block into a drawing (creating a block reference), try this code:

 

Sub Test_Insert()
Dim pts(0 To 2) As Double
pts(0) = 20: pts(1) = 20: pts(2) = 0
ThisDrawing.ModelSpace.InsertBlock pts, "C:\path\file1.dwg", 1, 1, 1, 0
End Sub

 

 


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. 😉
Message 3 of 3
Nicolas.L
in reply to: rhesusminus

Spoiler
 

Thanks a lot, I have tried your cod and it is working well!

 

 

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

Post to forums  

Autodesk Design & Make Report

”Boost