• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Electrical

    Reply
    Contributor
    Posts: 13
    Registered: ‎12-05-2012
    Accepted Solution

    Automaticly generate my electrical schema from .xls data

    229 Views, 2 Replies
    12-06-2012 12:15 AM

    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 :smileyhappy:

     

    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

     

    Please use plain text.
    Distinguished Mentor
    rhesusminus
    Posts: 569
    Registered: ‎09-21-2007

    Re: Automaticly generate my electrical schema from .xls data

    12-06-2012 02:45 AM 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

     

     


    THL
    Please select "Accept As Solution" if this post answers your question. Kudos don't hurt either. ;-)
    Please use plain text.
    Contributor
    Posts: 13
    Registered: ‎12-05-2012

    Re: Automaticly generate my electrical schema from .xls data

    12-06-2012 06:14 AM in reply to: rhesusminus
    Spoiler
     

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

     

     

    Please use plain text.