Need help with trans or mayne some other basic concept

Status
Not open for further replies.

Allan Seidel

Usenet Archive
Joined
Feb 11, 2000
Messages
298
Reaction score
0
Hello,
I'm having a problem getting this proceedure that spins an element to function when the ucs is other than world. I am trying to avoid the visual effects caused by temporarily changing the current ucs to world within the proceedure. I'm thinking trans should to the job since I've used it before but for this case trans seems to do nothing. Clearly I'm missing some basic concept. Here is the proceedure. Any help would be appreciated Thanks, Allan Seidel

; rotates element en by rot
;
(defun rotx (en rot / spt)
(setq spt (cdr (assoc '10 (entget (car en)))))
;(command "UCS" "W") work around I want to avoid
; This is where I think I should be using a trans
statement. Neither (trans spt (car en) 0 0) or (trans spt 1 0 0) or any trans variation changes spt (command "_rotate" en "" spt rot) ;(command "UCS" "P") work around I want to avoid (princ)
)
 
Hi.

Allan Seidel skrev i meddelelsen ...
From the lack of responses I guess I'm blacklisted. So I'll try again with some autolisp code that has got to be painfull enough for some of you autolisp experts to elicit the dopeslap response that I need because I am clearly missing a basic concept. This is what seems to work -- but why?

; rotates element en by rot
;
(defun rotx (en rot / spt xpt yspt zspt)
(setq spt (cdr (assoc '10 (entget (car en)))))
(setq xspt (nth 0 spt))
(setq yspt (nth 1 spt))
...

Yo don't ; from your code ( guess the ' before the 10 is not in the code you tries ) , listing the way you do, shuld bring the exact same list together, so you proberly are focusing on the wrong issue. Anyway everything about the Trans function need to be read quite litteraly, not one word to much in the manual, but you still miss some realistic samples. Guess that's why it is easyer to make one's own trans ,whenever a matrix manipulation are needed , that's my experience after number of situasions where I allway's thought, that if only Autodesk had made a more clear explanation about the trans function, everything would need one less step of evaluation. With the calculator loaded, this work in ver 14. :

(defun c-rot (pt ax1 ax2 v)
(setq mat(ap_rotate_axis (list ax1 ax2) v))
(setq lmat(list(last(car mat))(last(cadr mat))(last(caddr mat)))) (setq mat1(cons(mapcar '* pt (car mat)) (list(mapcar '* pt (cadr mat)) (mapcar '* pt (caddr mat)))) ) (setq npunkt(cons(apply '+ (car mat1)) (list(apply '+ (cadr mat1)) (apply '+ (caddr mat1)))) ) (list(mapcar '+ npunkt lmat))
)

It don't make use of the Rotate function but rotate a point (pt) around an axis defined by the two points ( ax1 ax2) Now the code are from back 1994, so I don't remember if the angle of rotasion are in deg. or Radians, but it rotate full 360 deg ;))

Have a nice day.
P.C.
http://w1.1396.telia.com/~u139600113/a
 
P.C.

Thanks, I just realized what was wrong. It was a basic concept. I was thinking the trans function performed the transformation on the point instead of returning a transformed point!

Allan

"P.C." wrote:

Hi.

Allan Seidel skrev i meddelelsen ...
>From the lack of responses I guess I'm blacklisted. So I'll try
>again with some autolisp code that has got to be painfull enough
>for some of you autolisp experts to elicit the dopeslap response
>that I need because I am clearly missing a basic concept. This
>is what seems to work -- but why?
>
>; rotates element en by rot
>;
>(defun rotx (en rot / spt xpt yspt zspt)
...
 
Status
Not open for further replies.

Latest threads

Back
Top