Jump to content

Recommended Posts

Posted

Hi all,

 

Good day to all, i have some problem with my Lisp route, When i used on a rotated UCS view the block is jumping away, please see attached code:

 

(Defun C:IBRK (/ aps pbs bs ss os oss sc entline elist pt angrad angdeg f s bk)
(setq bs (getvar "BLIPMODE"))
(setq ss (getvar "SNAPMODE"))
(setq os (getvar "ORTHOMODE"))
(setq oss (getvar "OSMODE"))
(setq aps (getvar "APERTURE"))
(setq pbs (getvar "PICKBOX"))
(setvar "blipmode" 0)
(setvar "cmdecho" 0)
; (setvar "snapmode" 0)
(setvar "orthomode" 0)
(setvar "osmode" 0)
(setvar "aperture" 6)
(setvar "pickbox" 6)         
(setq sc (getvar "dimscale"))
(setq bk (getstring "Select Valve to Insert - <B>all/<G>ate/<P>lug "))
(setq bk (strcase bk))
(if (= bk "B") (setq bk "BALLVLV"))
(if (= bk "G") (setq bk "GATEVLV"))
(if (= bk "P") (setq bk "PLUGVLV"))
(setq entline (entsel "\nPick line to break: "))
(setq elist (entget (car entline))
      pt (osnap (cadr entline) "quick,near")
   angrad (angle (cdr (assoc 10 elist)) (cdr (assoc 11 elist)))
)
(setq angdeg (/ (* 180.00 angrad) pi))
(setq f (polar pt angrad (* sc 140.00)))
(setq s (polar pt (+ angrad pi) (* sc 140.00)))
(command "BREAK" entline "F" f s)
(command "INSERT" bk pt sc sc angdeg)
(setvar "cmdecho" 1)
(setvar "blipmode" bs)
(setvar "snapmode" ss)
(setvar "orthomode" os)
(setvar "osmode" oss)
(setvar "aperture" aps)
(setvar "pickbox" pbs)
(print)        
)

 

Please if you can help me to fix with it or change the route if you have similar Lisp route with this that already arrange that i needed,:)

 

Many thanks

Posted

Try transforming the point using the (trans) function. That should let you get a point from your WCS to a UCS.

Posted

Also, instead of using loads of:

 

(setq oldvar (getvar "SYSVAR"))

 

You could make it much more concise using MAPCAR:

 

(setq varlist '("BLIPMODE" "SNAPMODE"...))
(setq oldvar (mapcar 'getvar varlist)

 

Then to reset:

 

(mapcar 'setvar varlist oldvar)

 

Lee

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...