Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Last block insertion rotation angle

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
293 Views, 7 Replies

Last block insertion rotation angle

Is the last roatation angle stored anywhere accessibls to LISP? I want to
have the user pick a rotation point on a block insert, then do another block
insert using the same rotation. I would like the user to see the first block
as it is being inserted, so they understand how the rotation affects the
block. Then I just want another block to insert with the same rotation.

Any help is greatly appreciated.

Gordon
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: Anonymous

I'm pretty sure there isn't. I'd just store the value in a
global var if you need it.

--
Kevin Nehls

"Gordon Price" wrote in message
news:44634121CBDF34A5B223ED45AB6D0A68@in.WebX.maYIadrTaRb...
> Is the last roatation angle stored anywhere accessibls to
LISP? I want to
> have the user pick a rotation point on a block insert,
then do another block
> insert using the same rotation. I would like the user to
see the first block
> as it is being inserted, so they understand how the
rotation affects the
> block. Then I just want another block to insert with the
same rotation.
>
> Any help is greatly appreciated.
>
> Gordon
>
>
Message 3 of 8
Anonymous
in reply to: Anonymous

In an "INSERT" entity, the rotation is stored as group code 50. So you just need to get that code from the first block.
hope this helped.
-J-
Message 4 of 8
Anonymous
in reply to: Anonymous

Unfortunately there is not a storage location for these types of values, but
I have written a sample that shows how you could implement such
functionality through AutoLISP. Below is the code that you could just cut
on paste into an AutoLISP file that you would make sure that is loaded at
start up. If you have any questions please let me know.

;; <----- Begin code example here
;;LAST_INS.LSP Copyright 2001 HyperPics all rights reserved
;;
;; Author: Lee Ambrosius
;; HyperPics, http://www.hyperpics.com


;; Convert Radians to Degrees
(defun RTD (rad)
(* (/ rad PI) 180)
)

;; Undefine the insert command
(command ".undefine" "insert")
(princ)

;; Redefine the insert command the way we need it to be
(defun c:insert ()
(command ".insert")
(while (not (zerop (getvar "CMDACTIVE")))
(command PAUSE)
)
(setq last_ins_ent (entlast))
(princ)
)

;; Define a function to return the angle on the last block inserted
(defun last_ins_ent_rot (/ ED)
(setq ED (entget last_ins_ent))
(rtd (cdr (assoc 50 ED)))
)

(princ)
;; ---------> End code example here

Thanks,
Lee Ambrosius
HyperPics, http://www.hyperpics.com



"Kevin Nehls" wrote in message
news:FDCA8C123759180AF0B39EB4E4B87BDC@in.WebX.maYIadrTaRb...
> I'm pretty sure there isn't. I'd just store the value in a
> global var if you need it.
>
> --
> Kevin Nehls
>
> "Gordon Price" wrote in message
> news:44634121CBDF34A5B223ED45AB6D0A68@in.WebX.maYIadrTaRb...
> > Is the last roatation angle stored anywhere accessibls to
> LISP? I want to
> > have the user pick a rotation point on a block insert,
> then do another block
> > insert using the same rotation. I would like the user to
> see the first block
> > as it is being inserted, so they understand how the
> rotation affects the
> > block. Then I just want another block to insert with the
> same rotation.
> >
> > Any help is greatly appreciated.
> >
> > Gordon
> >
> >
>
>
Message 5 of 8
Anonymous
in reply to: Anonymous

(defun lastblockangle ( )
  (* 180.0 (/
(cdr (assoc 50 (entget (entlast)))) pi))
)


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
In
an "INSERT" entity, the rotation is stored as group code 50. So you just need
to get that code from the first block.
hope this helped.

-J-
Message 6 of 8
Anonymous
in reply to: Anonymous

So, what's wrong with the "COPY" command?
Message 7 of 8
Anonymous
in reply to: Anonymous

"Herman Mayfarth" wrote in message
news:VA.0000012f.2d4a4254@tktn.com...
> So, what's wrong with the "COPY" command?
It is an insertion of a different block, but at the same rotation &
insertion point as the first block. I think Paul's snippet of code is going
to do the trick. I am off to try it now!

Gordon
Message 8 of 8
Anonymous
in reply to: Anonymous

> "Paul" discussion.autodesk.com@NOmofersSPAM.com> wrote in message
> news:D1CF26F74998182D399F724C0CFBD3F8@in.WebX.maYIadrTaRb...
> (defun lastblockangle ( )
> (* 180.0 (/ (cdr (assoc 50 (entget (entlast)))) pi))
> )
Worked like a charm! Learn something new every day (I tend to learn three or
four things every day 😉

Gordon

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost