+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 31
  1. #1
    Full Member clydemit's Avatar
    Computer Details
    clydemit's Computer Details
    Operating System:
    windows 7 ultimate 64bit
    Computer:
    Z800 Workstation HP
    CPU:
    Intel Xeon X5670 @ 2.93GHz (12 CPUs), ~2.9GHz
    RAM:
    24576MB RAM
    Graphics:
    NVIDIA Quadro FX 4800
    Primary Storage:
    300GB
    Secondary Storage:
    SERVER
    Monitor:
    HP Compaq LA2405 Wide LCD Monitor & Ibm ThinkVison LEN L192p
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Location
    Iowa
    Posts
    57

    Question Need help with macro

    Registered forum members do not see this ad.

    Ok so to give a little background what is going on I have Autocad 2010 with Rastercad Add on. I want to create a macro that will let me open a new drawing hit enter(for the basic autocad templete) and then run the command gattach which will open a window that will allow me to open my raster image. I can not get the new command to open the dwg templete without asking me. Here is what i have so far:

    ^C^C_new ;-Gattach
    Engineering Technician \ Documentation Manager
    www.clydegibson.tk
    Solidworks 2010-2012 / AutoCAD 2007-2012 / Inventor 2008-2009 / RasterCAD / Unigrapics NX6 - NX7
    "One man with courage is a majority." Thomas Jefferson

  2. #2
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,932

    Default

    You need to use Visual LISP.

    Look into the vla-Add , and vla-Activate Methods of the Documents Object, and the resultant Document Object respectively.
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Forum Deity Jack_O'neill's Avatar
    Computer Details
    Jack_O'neill's Computer Details
    Operating System:
    xp
    Discipline
    Architectural
    Jack_O'neill's Discipline Details
    Discipline
    Architectural
    Details
    The bulk of my business is commercial curtainwall, site plans and floor plans. I do occasionally get a bit of tool and die, and the odd house now and again.
    Using
    AutoCAD 2010
    Join Date
    Sep 2008
    Location
    lost in the Arkansas wilderness
    Posts
    2,146

    Default

    put this on a toolbar button:
    ^c^c filedia 0 _new ; filedia 1 -gattach.

    I don't have the rastercad addon you mentioned, but this works when I substitute ._move for -gattach. you may have to play with the gattach command a bit, but the first part will get you around the dialog box
    Never try to teach a pig to sing. It wastes your time and annoys the pig. -Robert Heinlein

  4. #4
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,932

    Default

    Example:

    Macro:
    Code:
    ^C^C(if (not c:FOO)(load "FOO"));FOO
    FOO.lsp code:
    Code:
    (defun c:FOO  ( / oAcad)
      (vl-load-com)
      (vla-activate
        (vla-add
          (vla-get-documents (setq oAcad (vlax-get-acad-object)))
          (vla-get-qnewtemplatefile
            (vla-get-files (vla-get-preferences oAcad)))))
      (princ))
    Simply replace all instances of "FOO" with whatever name you want.
    "Potential has a shelf life." - Margaret Atwood

  5. #5
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,932

    Default

    Quote Originally Posted by Jack_O'neill View Post
    put this on a toolbar button:
    ^c^c filedia 0 _new ; filedia 1 -gattach.

    I don't have the rastercad addon you mentioned, but this works when I substitute ._move for -gattach. you may have to play with the gattach command a bit, but the first part will get you around the dialog box
    I also do not have the add-on; if that works, then great.
    "Potential has a shelf life." - Margaret Atwood

  6. #6
    Forum Deity Jack_O'neill's Avatar
    Computer Details
    Jack_O'neill's Computer Details
    Operating System:
    xp
    Discipline
    Architectural
    Jack_O'neill's Discipline Details
    Discipline
    Architectural
    Details
    The bulk of my business is commercial curtainwall, site plans and floor plans. I do occasionally get a bit of tool and die, and the odd house now and again.
    Using
    AutoCAD 2010
    Join Date
    Sep 2008
    Location
    lost in the Arkansas wilderness
    Posts
    2,146

    Default

    Quote Originally Posted by RenderMan View Post
    I also do not have the add-on; if that works, then great.
    Sorry...started that answer, then got a phone call. By the time I finished and got back to it, your answer (which might be the better one) was there. The "filedia 0" part turns that dialog box off, "new" is obvious, the ; after it is an enter of course (causing it to use whatever default template you have set), then "filedia 1" turns the dialog box back on. After that, any command should work in the format you would use if you typed it in on the command line.
    Never try to teach a pig to sing. It wastes your time and annoys the pig. -Robert Heinlein

  7. #7
    Full Member clydemit's Avatar
    Computer Details
    clydemit's Computer Details
    Operating System:
    windows 7 ultimate 64bit
    Computer:
    Z800 Workstation HP
    CPU:
    Intel Xeon X5670 @ 2.93GHz (12 CPUs), ~2.9GHz
    RAM:
    24576MB RAM
    Graphics:
    NVIDIA Quadro FX 4800
    Primary Storage:
    300GB
    Secondary Storage:
    SERVER
    Monitor:
    HP Compaq LA2405 Wide LCD Monitor & Ibm ThinkVison LEN L192p
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Location
    Iowa
    Posts
    57

    Exclamation

    Quote Originally Posted by Jack_O'neill View Post
    put this on a toolbar button:
    ^c^c filedia 0 _new ; filedia 1 -gattach.

    I don't have the rastercad addon you mentioned, but this works when I substitute ._move for -gattach. you may have to play with the gattach command a bit, but the first part will get you around the dialog box

    I will try this then get back to you.
    Engineering Technician \ Documentation Manager
    www.clydegibson.tk
    Solidworks 2010-2012 / AutoCAD 2007-2012 / Inventor 2008-2009 / RasterCAD / Unigrapics NX6 - NX7
    "One man with courage is a majority." Thomas Jefferson

  8. #8
    Full Member clydemit's Avatar
    Computer Details
    clydemit's Computer Details
    Operating System:
    windows 7 ultimate 64bit
    Computer:
    Z800 Workstation HP
    CPU:
    Intel Xeon X5670 @ 2.93GHz (12 CPUs), ~2.9GHz
    RAM:
    24576MB RAM
    Graphics:
    NVIDIA Quadro FX 4800
    Primary Storage:
    300GB
    Secondary Storage:
    SERVER
    Monitor:
    HP Compaq LA2405 Wide LCD Monitor & Ibm ThinkVison LEN L192p
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Location
    Iowa
    Posts
    57

    Default

    Quote Originally Posted by Jack_O'neill View Post
    put this on a toolbar button:
    ^c^c filedia 0 _new ; filedia 1 -gattach.

    I don't have the rastercad addon you mentioned, but this works when I substitute ._move for -gattach. you may have to play with the gattach command a bit, but the first part will get you around the dialog box

    It was a no go it wants me to hit enter for each command it wont enter itself (enter meaning execute) within the new part of the command

    Could it have something to do with a setting i have on that i dont know about?
    Engineering Technician \ Documentation Manager
    www.clydegibson.tk
    Solidworks 2010-2012 / AutoCAD 2007-2012 / Inventor 2008-2009 / RasterCAD / Unigrapics NX6 - NX7
    "One man with courage is a majority." Thomas Jefferson

  9. #9
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,932

    Default

    *blink* *blink*
    "Potential has a shelf life." - Margaret Atwood

  10. #10
    Forum Deity Jack_O'neill's Avatar
    Computer Details
    Jack_O'neill's Computer Details
    Operating System:
    xp
    Discipline
    Architectural
    Jack_O'neill's Discipline Details
    Discipline
    Architectural
    Details
    The bulk of my business is commercial curtainwall, site plans and floor plans. I do occasionally get a bit of tool and die, and the odd house now and again.
    Using
    AutoCAD 2010
    Join Date
    Sep 2008
    Location
    lost in the Arkansas wilderness
    Posts
    2,146

    Default

    Registered forum members do not see this ad.

    Well, heckydurn as my wife would say. It worked here, several times...but now I can't get it to do it again. Ok...so that apparently don't work after all. Sorry. See Renderman's answer, maybe his will.

    This is very annoying. I sat here and ran it several times...each time it opened a new drawing...hmmm. If I get it fixed, I'll post what did. Its probably something pretty obvious that I'm just overlooking. Sitting there waving it's little arms at me I'm sure.

    Did find one mistake...there should be no space between the two cancels and the first "filedia".

    I will figure this out.
    Never try to teach a pig to sing. It wastes your time and annoys the pig. -Robert Heinlein

Similar Threads

  1. \ in macro
    By Lt Dan's legs in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 4
    Last Post: 23rd Nov 2010, 02:55 am
  2. Macro?
    By pvd in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 3rd Feb 2010, 04:47 pm
  3. help with macro
    By atb1984 in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 2nd Apr 2009, 10:25 am
  4. Help with Macro Please
    By xspacex in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 5th Mar 2008, 09:06 pm
  5. Macro Help
    By dreese1 in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 18th Aug 2005, 09:09 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts