See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: AutoLISP 101 - Entity Names - Discussion

  1. #1
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    1

    Default AutoLISP 101 - Entity Names - Discussion

    Entity Names

    Entities are necessary for manipulating data in drawing files.

    All graphic items (lines, circles, etc...) are entities.

    Useful Entity Functions

    Code:

    (entlast)

    will return the last graphic entity in a drawing.

    Code:

    (handent "1C7")

    will return the entity associated with the unique hexadecimal identifier called a handle.

    Code:

    (entsel)

    will prompt the user to select an object and return a list with two items including the entityname the point selected.

    So...

    Code:

    (car (entsel))

    will return a selected objects entity name (car returns the first item in a list)

    So to get and store an entityname you use the setq expression.

    Code:

    (setq entSelection (car (entsel "\nSelect One Item: ")))

    the entsel expression allows for a prompt ("\n" is a carriage return)

    The default prompt is "Select objects:"

    There is also

    Code:

    (setq entSelectionNested (car (nentsel "\nSelect nested item: ")))

    Which allows the user to select items nested inside other items (like blocks)

    Try it and comment to the discussion thread.
    AutomateCAD

  2. #2
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: AutoLISP 101 - Entity Names - Discussion

    You can use also (ssname)!

    ((lambda ( / js n)
    (setq js (ssget))
    (cond
    (js
    (repeat (setq n (sslength js))
    (print (ssname js (setq n (1- n))))
    )
    )
    )
    (prin1)
    ))

  3. #3
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    0

    Default Re: AutoLISP 101 - Entity Names - Discussion

    You are absolutely right.

    I have not got to selection sets yet...

    It is on the list.

    I just wanted to make each of these posts relatively short.

    Entity Lists, Tables and Selection are up soon.

    P=
    AutomateCAD

Similar Threads

  1. AutoLISP 101 - Loops Discussion
    By peter in forum AutoLISP
    Replies: 8
    Last Post: 2017-08-04, 04:11 PM
  2. Replies: 18
    Last Post: 2017-07-23, 03:42 AM
  3. AutoLISP 101 - Conditionals - Discussion
    By peter in forum AutoLISP
    Replies: 0
    Last Post: 2017-07-01, 09:58 PM
  4. Replies: 0
    Last Post: 2017-06-29, 07:04 PM
  5. Replies: 2
    Last Post: 2017-06-29, 06:02 PM

Posting Permissions

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