Image Detach using lisp

Discussion in 'AutoCAD' started by MarcelGoulet, Feb 18, 2004.

  1. MarcelGoulet

    MarcelGoulet Guest

    Hi,

    I'm trying to detach some image in a drawing, but it doesn't work.

    First, if I paste (command ".image" "detach" "Image Name") in the command line, it works.

    If I use the same line in a lisp program, AutoCAD freeze.

    Also, why an image doesn't have an association code (2) like the xref does ?

    Thanks
     
    MarcelGoulet, Feb 18, 2004
    #1
  2. MarcelGoulet

    Joe Burke Guest

    Marcel,

    Try the command line version of the image command. (command ".-image" ...)

    I don't know about your other question. The image file name and path are stored in
    the imagedef object associated with DXF code 340 in the primary image elist.

    Joe Burke
     
    Joe Burke, Feb 19, 2004
    #2
  3. MarcelGoulet

    MarcelGoulet Guest

    Hi,

    Thanks for the IMAGEDEF information, I now got what i want.

    But for the (command ".image" ...... ), that's what I was using, but it doesn't work.

    Thanks,

    Ciao
     
    MarcelGoulet, Feb 19, 2004
    #3
  4. MarcelGoulet

    Joe Burke Guest

    Marcel,

    Note the difference between: (command ".image" ...) and (command ".-image" ...) The
    "-" before the command name calls the command line version. Which is what you want in
    a lisp program given your original example.

    Joe Burke
     
    Joe Burke, Feb 19, 2004
    #4
  5. Hi Joe,

    I am noticing that using the "-" isn't really required. Now I
    haven't tested all commands, but off the top of my head....

    (command "layer")
    (command "image")
    (command "dimstyle")

    all go directly to the command line (A2K2)

    Not sure when this behavior started.
     
    Jason Piercey, Feb 19, 2004
    #5
  6. MarcelGoulet

    Joe Burke Guest

    Hi Jason,

    Well... that's interesting and confirmed.

    Wonder what version Marcel is using?

    Joe Burke
     
    Joe Burke, Feb 19, 2004
    #6
  7. MarcelGoulet

    Scot-65 Guest

    :

    Marcel,

    Try setting CMDDIA to 0 before statement
    and 1 afterwards.

    Scot-65
     
    Scot-65, Feb 19, 2004
    #7
  8. MarcelGoulet

    Joe Burke Guest

    Marcel,

    I steared you wrong with DXF code 340. To "detach" you need the name of the image.
    Which may or may not be the same as the file name, since you can rename. So maybe
    this will help.

    (defun ImageNames ( / elst namelst )
    (setq elst (dictsearch (namedobjdict) "acad_image_dict"))
    (foreach x elst
    (if (eq 3 (car x))
    (setq namelst (cons (cdr x) namelst))
    )
    )
    (reverse namelst)
    ) ;end

    Command: (ImageNames)
    ("Loc Map renamed" "Proj Map")

    Joe Burke
     
    Joe Burke, Feb 20, 2004
    #8
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.