Dxf versus Vlax

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

  1. Adesu

    Adesu Guest

    ;;;MODEL 1

    _$ (setq ss (ssget "x"))
    <Selection set: 60>
    _$ (setq ssn (ssname ss 0))
    <Entity name: 147fd80>
    _$ (setq sse (entget ssn))
    ((-1 . <Entity name: 147fd80>) (0 . "TEXT") (330 . <Entity name: 147fcf8>)
    (5 . "48") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 .
    "AcDbText") (10 9.01254 9.13091 0.0) (40 . 1.0) (1 . "Adesu") (50 . 0.0) (41
    .. 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 0) (11 0.0 0.0 0.0) (210
    0.0 0.0 1.0) (100 . "AcDbText") (73 . 0))


    ;;;MODEL 2

    _$ (vl-load-com)
    _$ (setq ao (vlax-get-acad-object))
    (setq ad (vlax-get-property ao 'ActiveDocument))
    #<VLA-OBJECT IAcadApplication 00ac8928>
    #<VLA-OBJECT IAcadDocument 00eaa9e4>

    With model 1 , I know how to find "entity name","start point',"end
    point","layer","color" etc ,with combination assoc,cons,subst ,entmod,entupd
    and etc.of course we can "change","revised","edit" and so on.
    But for model 2, I rather / still confuse what step (or way) to find
    anything?
    For alls expert lisp would you add to me to explain about that (model
    2),thanks.
     
    Adesu, Feb 7, 2005
    #1
  2. Adesu

    Joe Burke Guest

    Ade,

    These two functions return the same list, assuming the same line is selected. I hope
    this demonstrates the difference between MODEL 1 and MODEL 2.

    Code:
    (defun c:VLispMethod ( / elst vobj startpt endpt layer)
    (setq elst (entsel "\nSelect line: ")
    vobj (vlax-ename->vla-object (car elst))
    startpt (vlax-get vobj 'StartPoint)
    endpt (vlax-get vobj 'EndPoint)
    layer (vlax-get vobj 'Layer)
    )
    (list startpt endpt layer)
    )
    
    (defun c:DXFMethod ( / elst data startpt endpt layer)
    (setq elst (entsel "\nSelect line: ")
    data (entget (car elst))
    startpt (cdr (assoc 10 data))
    endpt (cdr (assoc 11 data))
    layer (cdr (assoc 8 data))
    )
    (list startpt endpt layer)
    )
    
    See developer help under ActiveX and VBA Reference for more information. It's all
    there. You just need to get friendly with the docs, and maybe ask a few more
    questions.

    Joe Burke
     
    Joe Burke, Feb 7, 2005
    #2
  3. Adesu

    ECCAD Guest

    Ade,
    Start here.

    ;; dump.lsp
    (defun C:dump (/ e)
    (vl-load-com)
    (setq e (entsel))
    (setq obj (vlax-ename->vla-object (car e)))
    (vlax-dump-object obj T)
    (princ)
    ); end function
    (C:dump)

    Above will dump a selected object (information) to
    textscreen.

    Then, go into Help->AutoLisp Reference->V Functions

    :)
    Bob
     
    ECCAD, Feb 7, 2005
    #3
  4. Adesu

    Don Butler Guest

    Some ideas to start you off...

    (defun c:dump ()
    (vl-load-com)
    (textpage)
    (vlax-dump-object (eval (read (getstring "\nObject name..."))) t)
    )

    ;;;Select Object
    (defun c:eek:bj (/ ent)
    (vl-load-com)
    (setq ent (entsel "\nSelect Object..."))
    (if ent
    (progn
    (vlax-dump-object
    (setq obj
    (vlax-ename->vla-object
    (car
    ent
    )
    )
    )
    t)
    (if obj
    (progn
    (textpage)
    (vl-prin1-to-string obj)
    )
    )
    )
    (alert "No object selected...")
    )
    (princ)
    )

    ;;;Select Nested Object
    (defun c:nobj (/ nent)
    (vl-load-com)
    (setq nent (nentsel "\nSelect Nested Object..."))
    (if nent
    (progn
    (vlax-dump-object
    (setq obj
    (vlax-ename->vla-object
    (car
    nent
    )
    )
    )
    t)
    (if obj
    (progn
    (textpage)
    (vl-prin1-to-string obj)
    )
    )
    )
    (alert "No object selected...")
    )
    (princ)
    )

    ;;;Select Entity
    (defun c:ent ()
    (princ)
    (setq entname (car (entsel "\nSelect Entity...")))
    (setq entlist (entget entname '("*")))
    (textpage)
    (mapcar 'print entlist)
    (getstring "\nReturn to continue...")
    (graphscr)
    (prompt "\nENAME is saved as \"ENTNAME\"..Entity list is saved as
    \"ENTLIST\"...")
    (princ)
    )

    ;;;Select Nested Entity
    (defun c:nent ()
    (princ)
    (setq entname (car (nentsel "\nSelect Nested Entity...")))
    (setq entlist (entget entname))
    (textpage)
    (mapcar 'print entlist)
    (getstring "\nReturn to continue...")
    (graphscr)
    (prompt "\nENAME is saved as \"ENTNAME\"..Entity list is saved as
    \"ENTLIST\"...")
    (princ)
    )

    HTH

    Don
     
    Don Butler, Feb 7, 2005
    #4
  5. Adesu

    Adesu Guest

    Hi Joe , ECCAD and Don,thanks a lot for your advice , your answer more than
    I ask
     
    Adesu, Feb 8, 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.