Help in a lisp neads

Discussion in 'AutoCAD' started by hmsilva, Mar 28, 2005.

  1. hmsilva

    hmsilva Guest

    Hello everyone...

    I'm trying to use this routine

    (defun C:BYLAYER
    ( / acad doc ssall i obj)
    (vl-load-com)
    (setq acad (vlax-get-acad-object)
    doc (vla-get-activedocument acad)
    )
    (vla-startundomark acad)
    (vla-zoomextents acad)
    (cond
    ( (setq ssall (ssget "x")); get all entities
    (setq i 0)
    (repeat (sslength ssall)
    (setq obj (vlax-ename->vla-object (ssname ssall i)))
    (vlax-put-property obj "Color" acByLayer)
    (vlax-put-property obj "Linetype" "ByLayer")
    (vlax-put-property obj "Lineweight" acLnWtByLwDefault)
    (vlax-release-object obj)
    (setq i (1+ i))
    )
    )
    )
    (vla-endundomark acad)
    (princ "\nFinished processing all entities.")
    (princ)
    )

    And I always get this message

    ; error: ActiveX Server returned the error: unknown name: ActiveDocument

    Why do I keep on receiving this message?

    Any ideas?

    Thanks to all future responses.

    Regards

    Henrique
     
    hmsilva, Mar 28, 2005
    #1
  2. hmsilva

    Matt W Guest

    Why not just use this: (command "change" "all" "" "p" "c" "bylayer" "lt"
    "bylayer" "lw" "bylayer" "" "") instead??
    Seems like a lot of extra code for nothing.
     
    Matt W, Mar 28, 2005
    #2
  3. hmsilva

    hmsilva Guest

    Hi Matt

    I only wont's to know where is the error...
    Not to use this code, but to use in others..

    Thanks

    Henrique
     
    hmsilva, Mar 28, 2005
    #3
  4. hmsilva

    ECCAD Guest

    (setq doc (vla-get-ActiveDocument
    acad (vlax-get-acad-object)))
    or --------
    (setq acad (vlax-get-acad-object))
    (setq doc (vla-get-activedocument acad))

    Bob
     
    ECCAD, Mar 28, 2005
    #4
  5. hmsilva

    hmsilva Guest

    Thanks Bob

    Henrique
     
    hmsilva, Mar 28, 2005
    #5
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.