Jump to content

Recommended Posts

Posted

I cant figure out the if statement to test if my variable ent is a circle.

defined by "(setq ent (car (nentselp pt)))"

Posted

Why are you using the nentselp function ? are you after selecting nested object ? if not, then use the entsel function instead.

 

To check if the selected object is a Circle:

(= (cdr (assoc 0 (entget ent))) "CIRCLE")

The above code should return T ( true ) if the object is Circle otherwise nil.

  • Thanks 1
Posted (edited)

Modifying a lisp Lee Mac made back in '09. it does what i need but doesn't work on circles. adding the if statement and using the trim command for when a circles is selected.

    (if (not (= (cdr (assoc 0 (entget ent))) "CIRCLE"))
      (command "_.break" (list ent pt) "_F" "_non" (polar pt ang (/ off 2.)) "_non" (polar pt (+ pi ang) (/ off 2.)))
      (progn
        (vl-cmdf "_circle" pt "0.0078")
        (setq obj (entlast))
        (vl-cmdf "_view" "save" "s")
        (vl-cmdf "_Zoom" "OB" obj "")
        (vl-cmdf "_trim" obj "" pt "")
        (vl-cmdf "_erase" obj "")
        (vl-cmdf "_view" "restore" "s")
      )
    )

And thank you for the help.

Edited by mhupp
Posted (edited)

You're welcome anytime.

 

A few mods if you are interested.

 

(if (= (cdr (assoc 0 (entget ent))) "CIRCLE")
  (progn
   (vl-cmdf "_circle" "_non" pt "0.0078")
        (setq obj (entlast))
        (vl-cmdf "_view" "save" "s")
        (vl-cmdf "_Zoom" "OB" obj "")
        (vl-cmdf "_trim" obj "" "_non" pt "")
        (vl-cmdf "_erase" obj "")
        (vl-cmdf "_view" "restore" "s")
  )
  (command "_.break"
           (list ent pt)
           "_F"
           "_non"
           (polar pt ang (/ off 2.))
           "_non"
           (polar pt (+ pi ang) (/ off 2.))
  )
)

 

Edited by Tharwat
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...