After that hang.....why?

Discussion in 'AutoCAD' started by Adesu, Feb 25, 2005.

  1. Adesu

    Adesu Guest

    _$ (vl-load-com)
    (setq osdi (getvar "SDI"))
    (setvar "SDI" 1)
    (setq oli (getvar "LISPINIT"))
    (setvar "LISPINIT" 0)
    (setq file1 "C:/Auto CAD 2000/Drawing1.DWG")
    (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) file1))
    (setq loc (list 0 0))
    (setq hei 1)
    (setq str "Adesu")
    (command "_text" loc hei "" str "")
    (prompt "\nSELECT A TEXT")
    (setq ss (ssget "x" '((0 . "TEXT"))))
    (command "_copyclip" ss "")
    (setq file2 "C:/Auto CAD 2000/Drawing2.DWG")
    (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) file2))
    (setq p1 (list 10 10))
    (command "_pasteclip" p1 "")
    (setvar "SDI" osdi)
    (setvar "LISPINIT" oli)

    0
    1
    1
    0
    "C:/Auto CAD 2000/Drawing1.DWG"
    nil
    (0 0)
    1
    "Adesu"
    ; error: Exception occurred: 0xC0000005 (Access Violation)
    ; warning: unwind skipped on exception
    ; error: Exception occurred: 0xC0000005 (Access Violation)
    ; error: Exception occurred: 0xC0000005 (Access Violation)
    ; error: Exception occurred: 0xC0000005 (Access Violation)
    _$
     
    Adesu, Feb 25, 2005
    #1
  2. Adesu

    dblaha Guest

    The vla method you are using won't work in SDI mode.

    Dave
     
    dblaha, Feb 28, 2005
    #2
  3. Adesu

    dblaha Guest

    Try the code below. I've modified a number of things.
    I've changed the code for opening the files so that it won't conflict with SDI mode.
    The "text" command does not allow you to directly specify the height. It only allows you to specify the rotation, so as it was written, your routine was specifying an angle of 1 degree for the text. I've modified it so that it creates the text with 0 degrees of rotation. The height of the text is determined by what is defined in the current text style.
    I've removed the "" from the _pasteclip function because it is not necessary.

    Dave


    (defun c:t1 ()
    (setq osdi (getvar "SDI"))
    (setvar "SDI" 1)
    (setq oli (getvar "LISPINIT"))
    (setvar "LISPINIT" 0)
    (command "zoom" "e")
    (setq file1 "C:/Auto CAD 2000/Drawing1.DWG")
    (command "open" "y" file1)
    (setq loc (list 0 0))
    (setq str "Adesu")
    (command "_text" loc "0" str "")
    (princ "\nSELECT A TEXT")
    (setq ss (ssget "x" '((0 . "TEXT"))))
    (command "_copyclip" ss "")
    (setq file2 "C:/Auto CAD 2000/Drawing2.DWG")
    (command "open" "y" file2)
    (setq p1 (list 10 10))
    (command "_pasteclip" p1)
    (setvar "SDI" osdi)
    (setvar "LISPINIT" oli)
    )
     
    dblaha, Feb 28, 2005
    #3
  4. Adesu

    Adesu Guest

    Thanks dblaha,I will tested it.
    It only allows you to specify the rotation, so as it was written, your
    routine was specifying an angle of 1 degree for the text. I've modified it
    so that it creates the text with 0 degrees of rotation. The height of the
    text is determined by what is defined in the current text style.
     
    Adesu, Mar 1, 2005
    #4
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.