+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Senior Member
    Computer Details
    pmxcad's Computer Details
    Operating System:
    win 7 pro
    Computer:
    HP Z420
    CPU:
    xenon
    RAM:
    32G
    Monitor:
    2x
    Using
    Electrical 2014
    Join Date
    Apr 2011
    Posts
    118

    Default get data from attribute needs help

    Registered forum members do not see this ad.

    Hello.
    I made my first lisp. It`s a simple one and looks like script. It works ok (i have to copy and paste bij myself)but i want it to do automatic.

    Sure there is better way to do it, but it is a start.
    I want the lisp to do:

    -Select a attribute from a block (VIEWP, rectangle)
    -copie the value
    -starts the view command to create named view
    -W from window
    -Autocad asked for a name
    -Paste the attribute value
    -Enter
    -And selecting a window for the named-view..by me

    Done


    It looks simple but i don`t think it is.
    The copie and paste things are difficult for me.
    I used PAUSE for user input. It works, but it can be better.


    Thanks,

    PmxCAD
    Attached Files

  2. #2
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,058

    Default

    Assuming:

    The tagname of the attribute is always "NAMEDVW"
    The ATTRIB string value is a valid symbol name



    Maybe something like this:

    Code:
    (defun c:nvw (/ ss en an ad nv p1 p2)
      (and (setq ss (ssget '((0 . "INSERT")(66 . 1))))
           (= (sslength ss) 1)
           (setq en (ssname ss 0)
                 an (entnext en)
                 ad (entget an))
           (while (= "ATTRIB" (cdr (assoc 0 ad)))
                  (and (= "NAMEDVW" (cdr (assoc 2 ad)))
                       (setq nv (cdr (assoc 1 ad))))
                  (setq an (entnext an)
                        ad (entget an))))
      (if nv
        (progn
           (initget 1)
           (setq p1 (getpoint (strcat "\nSelect 1 Corner Of " nv " View Window:  ")))
           (initget 1)
           (setq p2 (getcorner p1 "\nSelect Opposite Corner Of View Window:   "))
           (command "_.VIEW" "_Window" nv p1 p2))
        (alert "No View Names Found"))
      (prin1 nv)
      (prin1))

    -David
    Last edited by David Bethel; 26th Feb 2012 at 12:57 pm. Reason: Change c: command name to avoid conflict in 2012
    R12 (Dos) - A2K

  3. #3
    Senior Member
    Computer Details
    pmxcad's Computer Details
    Operating System:
    win 7 pro
    Computer:
    HP Z420
    CPU:
    xenon
    RAM:
    32G
    Monitor:
    2x
    Using
    Electrical 2014
    Join Date
    Apr 2011
    Posts
    118

    Default

    Thanks David.
    It is not working. Wel it does something, It opens the view dialog. What i like to have, Is running the lisp, select an attribute from a block, and after that, selecting/pick-points for the view..........done.
    The value/text from the selected attribute becomes the name of the named view.

    Thanks,

    PmxCAD

  4. #4
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,058

    Default

    It must be a setting in filedia or some dialog setting. It works on my systems R12 r13 2004 2012

    -David
    R12 (Dos) - A2K

  5. #5
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,638

    Default

    Quote Originally Posted by pmxcad View Post
    Thanks David.
    It is not working. Wel it does something, It opens the view dialog. What i like to have, Is running the lisp, select an attribute from a block, and after that, selecting/pick-points for the view..........done.
    The value/text from the selected attribute becomes the name of the named view.

    Thanks,

    PmxCAD
    Works here as well (2009)

    I suggest you change the c:newview to something else like c:NW

  6. #6
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,058

    Default

    Quote Originally Posted by pBe View Post
    Works here as well (2009)

    I suggest you change the c:newview to something else like c:NW
    Looks like pBe is correct . NEWVIEW is a internal ACAD commend now. -David
    R12 (Dos) - A2K

  7. #7
    Senior Member
    Computer Details
    pmxcad's Computer Details
    Operating System:
    win 7 pro
    Computer:
    HP Z420
    CPU:
    xenon
    RAM:
    32G
    Monitor:
    2x
    Using
    Electrical 2014
    Join Date
    Apr 2011
    Posts
    118

    Default

    Registered forum members do not see this ad.

    Yep.change it to nv.............works fine, thanks fooks.

    PmxCAD

Similar Threads

  1. Match Attribute Data
    By woodman78 in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 22nd Jun 2012, 10:30 am
  2. Object Data to Attribute Data to perfection
    By cris2fur in forum AutoCAD General
    Replies: 13
    Last Post: 30th Nov 2011, 06:39 am
  3. Repeating data in Attribute Block
    By andythoms in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 18th May 2010, 09:59 am
  4. Moving Attribute data from one border to another
    By Norc in forum AutoCAD Drawing Management & Output
    Replies: 0
    Last Post: 18th Jun 2007, 06:08 pm
  5. Extracting attribute data
    By j_r_auden in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 3rd Feb 2005, 09:23 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts