Program activate in a drawing and execute and an other one

Discussion in 'AutoCAD' started by Marcel Goulet, Feb 24, 2005.

  1. Hi,

    I would like to do a program that will be activate in Drawing 1, but that program will execute someting in Drawing 2. Then the program close drawing 2, and open and other one to execute the same thing in that new 2nd drawing, and an other, etc... Is that possible ?
     
    Marcel Goulet, Feb 24, 2005
    #1
  2. Marcel Goulet

    Bob Guest

    Marcel,

    That is definitely possible using ActiveX. You can access ActiveX in a
    variety of ways... I'm only really familiar with Lisp. Here's some sample
    lisp code that will get you started. You run this in your current session
    of AutoCAD and it will launch another ACAD drawing, create a 3D box, save it
    with the file name "bob", then shut the other session of AutoCAD down.

    (vl-load-com)
    (setq ACADObject (vlax-get-acad-object)
    ACADCollection (vlax-get-property ACADObject 'Documents)
    MyNewDoc (vlax-invoke-method ACADCollection 'Add)
    CurrentModelSpace (vlax-get-property MyNewDoc 'ModelSpace)
    x-ipt 10.0
    y-ipt 10.0
    z-ipt 10.0
    box-depth 5.0
    box-width 8.0
    box-length 20.0
    mybox (vla-addBox CurrentModelSpace (vlax-3D-point (list x-ipt y-ipt
    z-ipt)) box-depth box-width box-length)
    );setq
    (vlax-invoke-method MyNewDoc 'Saveas "bob.dwg")
    (vlax-invoke-method MyNewDoc 'Close)

    A word of warning... not everything works the way it should using Lisp to
    create and modify other drawing sessions. For example, it is not possible
    to add text and then change the alignment of that text using LISP. Well,
    you can actually change the alignment but you can't force ACAD to show the
    text using that new alignment. And a couple of other minor issues.

    Hope this helps.
    Bob
     
    Bob, Feb 24, 2005
    #2
  3. Hi Bob,

    That program is very close to what I want to do.
    It's a little bit difficult for me to understand well the way to program it. What I need is not to make a new drawing but open an existing one, execute a program, save it and pass to an other one. I have to di that for each dwg of a folder.
    Is it difficult to change the code ?
     
    Marcel Goulet, Feb 24, 2005
    #3
  4. Marcel Goulet

    Bob Guest

    No it's not difficult to change the code that I gave you to do this.
    Everything you need is in the Developer Help that ships with ACAD.
    Alternatively you could have me or any one of a few dozen of the people who
    frequent this forum to write it for you for a small fee.
    Cheers,
    Bob
     
    Bob, Feb 24, 2005
    #4
  5. Thanks any way!
     
    Marcel Goulet, Feb 24, 2005
    #5
  6. Hi Bob,

    Would communicate whit me by email to talk about fees to do that program I need, and I will explain what exactly I need.

    My email is :

    Thanks
     
    Marcel Goulet, Feb 24, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.