Getfiled dialog box verse dialog box thru command line

Discussion in 'AutoCAD' started by Tom Quok, Sep 27, 2004.

  1. Tom Quok

    Tom Quok Guest

    I'm using the "getfiled" to select a xref dwg file to xref in my routine
    (so I can control insert layer and scale factor with visual lisp) .

    I notice that the "getfiled" bring up a different dialog box than the one
    you get when you type in "-xref" at the command line.

    I wanted to be able to select my xref file using the view "subject" &
    category" option turned on. I'am able to set this as the default if I type
    "-Xref" at the command line. However, thru "getfiled", I have to set this
    manually each time the dialog box is open. Is there a way to set this view
    as a default so that I do not have to manually do this each time ?

    Tom
     
    Tom Quok, Sep 27, 2004
    #1
  2. Tom Quok

    j.buzbee Guest

    I use a command reactor that traps the vlr-commandwillstart,
    vlr-commandended, and vlr-commandcancelled events. Have it look for
    xref, -xref, and xattach. On the vlr-commandwillstart event save the
    current layer name, for switching back later, create the layer you want
    xrefs to go on, WITHOUT using (command . . .), and set it current. On either
    vlr-commandended or commandcancelled reset the layer to the previous saved
    active layer (WITHOUT using the "command" function).

    Search for command reactors - there are plenty of examples to get you
    started. They're good for anything you want to automatically put on it's
    own layer: TEXT, DIMS, etc . . . Hmmm.

    jb
     
    j.buzbee, Sep 27, 2004
    #2
  3. Tom Quok

    Tom Quok Guest

    Reactors sounds great... but reactor is a bite over my head at this time.
    I've already written a routine that basically does what I wanted. I just
    need a way to get the dialog box to give me the "subject & category" view
    option as a default without doing it manually each time. Can't seen to be
    able to find anything that will allow me to do this using "getfiled".
     
    Tom Quok, Sep 27, 2004
    #3
  4. Tom Quok

    j.buzbee Guest

    I know . . . there are some 3rd party utilities out there that expose the
    FileNav dialog (like the "open" and "xattach" dialog) but nothing in lisp -
    and I've looked for a windows system dll that may have it exposed with no
    luck. So until AutoDESK makes it available in Autolisp we're stuck with
    getfiled.

    jb
     
    j.buzbee, Sep 28, 2004
    #4
  5. Tom Quok

    j.buzbee Guest

    Sometimes I think too much . . . you needed a tack hammer, I was thinking
    sledge:

    Here's a tack hammer: No error checking - add that yourself.

    (defun c:jbXref( / )
    (setq thisdrawing(vlax-get(vlax-get-acad-object)'activedocument)
    layers(vlax-get thisdrawing 'layers)
    curlayer(vlax-get thisdrawing 'activelayer)
    newlayer "XREF")
    (if (not (tblsearch "layer" newlayer))
    (setq lobj(vlax-invoke layers 'add newlayer))
    (setq lobj(vlax-get layers newlayer)))

    (vlax-put thisdrawing 'activelayer lobj)
    (command "xattach")
    (while (= (logand (getvar "CMDACTIVE") 1) 1) (command pause))
    (vlax-put thisdrawing 'activelayer curlayer)
    (princ))
     
    j.buzbee, Sep 28, 2004
    #5
  6. Tom Quok

    Tom Quok Guest

    How do I get the name of the xref file prior to completing the "xattach"
    command?
    I still need to scale the xref file based on the required scale factor. The
    scale factor is part of the file name. So, once I selected the file, my
    routine needs check name of file selected to set scale factor prior to
    finishing the "xattach".
     
    Tom Quok, Sep 28, 2004
    #6
  7. Tom Quok

    j.buzbee Guest

    I would do that after the file is attached (but still within the routine)

    (defun c:jbXref( / thisdrawing layers curlayer newlayer lobj blockent)
    (setq thisdrawing(vlax-get(vlax-get-acad-object)'activedocument)
    layers(vlax-get thisdrawing 'layers)
    curlayer(vlax-get thisdrawing 'activelayer)
    newlayer "XREF")
    (if (not (tblsearch "layer" newlayer))
    (setq lobj(vlax-invoke layers 'add newlayer))
    (setq lobj(vlax-invoke layers 'item newlayer)))

    (vlax-put thisdrawing 'activelayer lobj)
    (command ".xattach")
    (while (= (logand (getvar "CMDACTIVE") 1) 1) (command pause))
    (vlax-put thisdrawing 'activelayer curlayer)
    ;;; manipulate the xref(block) here
    (setq blockent(entget(entlast)))
    ;;; Now you have an entity to modify: blockent
    (princ))
     
    j.buzbee, Sep 28, 2004
    #7
  8. Tom Quok

    j.buzbee Guest

    Yea . . . Zoo School. Get it?
     
    j.buzbee, Sep 29, 2004
    #8
  9. Tom Quok

    Tom Quok Guest

    Problem with doing it after the file is attached is that a second dialog box
    will pop up after you select the file which prompt you for scale, rotation,
    attach, overlay, etc. Is there a way to "pre-set" this info prior to issue
    "xattach". Or better yet, is there a way to "pre-set" these info and disable
    the second dialog box and go right into "pick insert point" ?
     
    Tom Quok, Sep 29, 2004
    #9
  10. Tom Quok

    j.buzbee Guest

    Yes. Use "-xref" instead of "xattach" (you'll only be able to do them one
    at a time though.)
    Supply scale and rotation variables from what ever routine you have getting
    them:

    ;;;use (jb:Xref 1 1 0)

    (defun jb:Xref(xscale yscale rotation / thisdrawing layers curlayer newlayer
    lobj blockent)
    (setq thisdrawing(vlax-get(vlax-get-acad-object)'activedocument)
    layers(vlax-get thisdrawing 'layers)
    curlayer(vlax-get thisdrawing 'activelayer)
    newlayer "XREF")
    (if (not (tblsearch "layer" newlayer))
    (setq lobj(vlax-invoke layers 'add newlayer))
    (setq lobj(vlax-invoke layers 'item newlayer)))

    (vlax-put thisdrawing 'activelayer lobj)
    (initdia)
    (command "-xref" "_attach")
    (while (= (logand (getvar "CMDACTIVE") 8) 1) (command pause))
    ;;; now apply pre-sets
    (command pause);user select insertion point
    (command xscale yscale rotation)
    (vlax-put thisdrawing 'activelayer curlayer)
    (princ))
     
    j.buzbee, Sep 29, 2004
    #10
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.