View Full Version : Scale objects along 1 axis
Randolph
1st Nov 2009, 06:49 pm
I'm looking for a procedure to scale objects along 1 axis only.
The varia command doesn't work this way. It always scales along all 3 axis.
Workaround:
make objects block
delete objects
insert block
scale block in x,y- or z-direction only.
As I like to automate things :P, this appears a little like awkward.
Can anybody help? Thanx!
lpseifert
1st Nov 2009, 08:39 pm
The lisp routine found here does what your workaround does
http://www.cadtutor.org/forum/showthread.php?t=23441
alanjt
1st Nov 2009, 09:34 pm
Temporarily converting it to a block is probably the best method, since you can't stretch things like circles.
Randolph
1st Nov 2009, 10:32 pm
hi lp,
thanks. i read the code thru and i guess you're right, it seems to do exactly what i described. strange enough that you have to do such things to get a result, which is the easiest thing in any other cad application.
alanjt
2nd Nov 2009, 05:13 am
Kinda bored....
What about something like this:
15244
Subroutine required: http://www.cadtutor.net/forum/showpost.php?p=280379&postcount=42
Randolph
2nd Nov 2009, 09:12 am
Hi Alan, thanks, but don't be too bored:
Befehl: xyz
Objekte wählen: 1 gefunden
Objekte wählen:
Specify base point:
Geometry factor to scale [X/Y/Z]: x
Error: no function definition: AT:INSERTBLOCK
However, the scaleaxis function didn't work either - didn't explode the block. If you scalaxis another object, the previously scaleaxised object will be changed to the second object, as the same block is beeing redefined. Strange enough, the block cannot be exploded manually, either.
ica_cici
2nd Nov 2009, 10:00 am
Try FIT.lsp
see at thread http://www.cadtutor.net/forum/showthread.php?t=40104
It solves my problem.
Randolph
3rd Nov 2009, 12:39 pm
Hi ica,
I'm rotating with work right now. I hope I can try FIT.lsp today or tomorrow.
PS: Alan,
I just tried your zerorotation, as I had to rotate 5 floors of plan. it worked quite well except for some rooms, and it also rotated my cars in the garage. still, it saved me a load of work! thanxalot!
Randolph
3rd Nov 2009, 12:46 pm
I just read the readme of fit.lsp by xordesign. it says:
"This tool scales any selection of 2D elements to fit a custom X/Y boundry"
I'm afraid I need to scale 3D elements. And either by a scale factor as well as with a reference. A pity that scaleaxis doesn't work properly.
alanjt
3rd Nov 2009, 02:06 pm
Hi Alan, thanks, but don't be too bored:
Befehl: xyz
Objekte wählen: 1 gefunden
Objekte wählen:
Specify base point:
Geometry factor to scale [X/Y/Z]: x
Error: no function definition: AT:INSERTBLOCK
However, the scaleaxis function didn't work either - didn't explode the block. If you scalaxis another object, the previously scaleaxised object will be changed to the second object, as the same block is beeing redefined. Strange enough, the block cannot be exploded manually, either.
Guess that might help. :)
http://www.cadtutor.net/forum/showpost.php?p=280379&postcount=42
alanjt
3rd Nov 2009, 02:07 pm
PS: Alan,
I just tried your zerorotation, as I had to rotate 5 floors of plan. it worked quite well except for some rooms, and it also rotated my cars in the garage. still, it saved me a load of work! thanxalot!
Glad you got some use from it. :)
When you say except for some rooms, what did it do/not do?
Randolph
3rd Nov 2009, 04:21 pm
with rooms i mean the room definition as we call it, don't no the english name.
it's the text which says "sleeping room, 19.23 m², parquet". It stayed as it was. but don't worry too much about that, as they came from an imported plan and I had problems with their rotation from the beginning on. But more interesting:
I found out that zerorotation rotates ALL BLOCKS - also loos and washing machines.
alanjt
3rd Nov 2009, 04:26 pm
with rooms i mean the room definition as we call it, don't no the english name.
it's the text which says "sleeping room, 19.23 m², parquet". It stayed as it was. but don't worry too much about that, as they came from an imported plan and I had problems with their rotation from the beginning on. But more interesting:
I found out that zerorotation rotates ALL BLOCKS - also loos and washing machines.
Post an example of this strange text.
ZeroRotation will rotate: TEXT MTEXT, MULTILEADERs, ATTDEF and BLOCKs.
ica_cici
3rd Nov 2009, 04:31 pm
I just read the readme of fit.lsp by xordesign. it says:
"This tool scales any selection of 2D elements to fit a custom X/Y boundry"
I'm afraid I need to scale 3D elements. And either by a scale factor as well as with a reference. A pity that scaleaxis doesn't work properly.
Yes, this fit.lsp is based on x/y boundary but if you want to scale an object only in one axis, you can set the other axis in 1 or same as the reference.
For an example:
Imagine you have a box (x,y,z)=(2X3X4)
and you want to scale it by the x axis only, so the box new sizes are (x,y,z)=(4x3x4).
here the steps:
After loading the fit.lsp , you will asked for - X: Specify Reference width and direction (A Point Please):2
X: Specify new width (A Point please):4
Y: Specify Reference height:1
Y: Specify new height:1or
After loading the fit.lsp , you will asked for - X: Specify Reference width and direction (A Point Please):2
X: Specify new width (A Point please):4
Y: Specify Reference height:3
Y: Specify new height:3 It can be used for vice versa (scale by the y axis), and if you want to scale the z axis only just change the view port and put the z point to the y reference ordinate, set the x axis in 1.
Randolph
3rd Nov 2009, 05:17 pm
"Post an example of this strange text."
No time now, as it's not very important. It's a block consisting of text, it shows no rotation attribute in the attribute editor, and if you double click it, the "Enhanced Attribute Editor" opens. Ther you find diverse attributes for room specification. But as I said, never mind, and it's the wrong thread anyway. By the anyway: my fillet and chamfer problem is more important ... :)
Randolph
3rd Nov 2009, 06:08 pm
Hi Ica,
I tried it and it worked so far. The problem is - as far as I have seen, that I have to know the original and the new length. As in most cases I don't know either, I would have to measure. Now my original length is 213,17 cm (for example a wall which has been cut at an angle), and my new length should be 429,38 cm. Do I have to enter both values manually?
alanjt
3rd Nov 2009, 06:32 pm
"Post an example of this strange text."
No time now, as it's not very important. It's a block consisting of text, it shows no rotation attribute in the attribute editor, and if you double click it, the "Enhanced Attribute Editor" opens. Ther you find diverse attributes for room specification. But as I said, never mind, and it's the wrong thread anyway. By the anyway: my fillet and chamfer problem is more important ... :)
True, but if there's an issue with the routine it IS important to me.
I've told you from the start on your fillet, chamfer issue, repair the install.
Randolph
3rd Nov 2009, 09:47 pm
If it's important to you, I'll send you an example.
Concerning the blocks, I think it would be nice to leave them out or make a choice. Because when rotating a plan, I have to re-rotate the text, but not the toilets. On the other side, they're on a different layer anyway, so I just turn it off or lock it.
True, you told me to, but it would have been a little risky and 2 fullstops in the lisp also did the job. Quite astonishing. Of course without solving ar analyzing the actual problem.
alanjt
3rd Nov 2009, 09:54 pm
If it's important to you, I'll send you an example.
Yeah, if you don't mind. :)
Concerning the blocks, I think it would be nice to leave them out or make a choice. Because when rotating a plan, I have to re-rotate the text, but not the toilets. On the other side, they're on a different layer anyway, so I just turn it off or lock it.
That's what QSelect is for.
True, you told me to, but it would have been a little risky and 2 fullstops in the lisp also did the job. Quite astonishing. Of course without solving ar analyzing the actual problem.
I'm so pissed about that, I could have sworn I told you to use "_.fillet". I even went back and found the original thread. It occurred to me, I apparently never posted it. Glad someone was smart enough to get you straightened out. :)
Randolph
3rd Nov 2009, 10:01 pm
Well, how about scaling?
fit works, but a little complicated, as it seems.
scaleaxis and xyz both have bugs.
Randolph
3rd Nov 2009, 10:04 pm
Don't be too pissed, cause it's "._fillet" anyway :P.
But to be honest, I'm really happy and wanted to thank you for all your help, Alan.
alanjt
3rd Nov 2009, 10:36 pm
Don't be too pissed, cause it's "._fillet" anyway :P.
But to be honest, I'm really happy and wanted to thank you for all your help, Alan.
The order _. or ._ does not matter.
You are quite welcome :)
What are the bugs with XYZ? You never gave a response after I posted the link to the subroutine.
Randolph
3rd Nov 2009, 10:43 pm
Oh yes, i did give response, right after you posted your gif animation. Quote:
Hi Alan, thanks, but don't be too bored:
Befehl: xyzObjekte wählen: 1 gefundenObjekte wählen:Specify base point:Geometry factor to scale [X/Y/Z]: xError: no function definition: AT:INSERTBLOCK
Gefunden means found.
alanjt
3rd Nov 2009, 10:48 pm
Oh yes, i did give response, right after you posted your gif animation. Quote:
Hi Alan, thanks, but don't be too bored:
Befehl: xyzObjekte wählen: 1 gefundenObjekte wählen:Specify base point:Geometry factor to scale [X/Y/Z]: xError: no function definition: AT:INSERTBLOCK
Gefunden means found.
LoL
I responded to that like 8 hours ago.
15284
Randolph
3rd Nov 2009, 11:09 pm
Ah, ok, that was when I was in trouble at work.
So I copy&paste both your xyz.lisp and insertblock somewhere into my general acad.lisp?
Got to go to sleep now, it's past 23:00 round here an I got to get up tomorrow. Good night!
alanjt
3rd Nov 2009, 11:19 pm
Ah, ok, that was when I was in trouble at work.
So I copy&paste both your xyz.lisp and insertblock somewhere into my general acad.lisp?
Got to go to sleep now, it's past 23:00 round here an I got to get up tomorrow. Good night!
Just stick it in the same .lsp file as XYZ.
It's 5pm here. :)
ica_cici
4th Nov 2009, 07:09 am
Hi Ica,
I tried it and it worked so far. The problem is - as far as I have seen, that I have to know the original and the new length. As in most cases I don't know either, I would have to measure. Now my original length is 213,17 cm (for example a wall which has been cut at an angle), and my new length should be 429,38 cm. Do I have to enter both values manually?
Yes, you do. Just input the reference and the new length, no need to find the scale factor. It will be more complicated to find the scale factor if it's not an integer and you'll get imprecision dimension (just like your values).:)
Randolph
4th Nov 2009, 03:02 pm
"It's 5pm here." So you mean 17:00 ? :) Going to try your routine asap. And it's now half past three and seven minutes in the afternoon.
Concerning precision: If I have to measure and re-enter my values, I get the precision problem right there. Or how many decimals am I supposed to enter? And in your example - it doesn't seem to make much any differnece whether I enter "1" and "2" or "2" and "4". In short: it would be great if your routine would reference.
alanjt
4th Nov 2009, 04:58 pm
"It's 5pm here." So you mean 17:00 ? :) Going to try your routine asap. And it's now half past three and seven minutes in the afternoon.
Concerning precision: If I have to measure and re-enter my values, I get the precision problem right there. Or how many decimals am I supposed to enter? And in your example - it doesn't seem to make much any differnece whether I enter "1" and "2" or "2" and "4". In short: it would be great if your routine would reference.
I put something together with what information I had. It scales the X,Y,Z values based on distance provided, you can pick a distance. As far as referencing, give it a shot.
Randolph
7th Nov 2009, 12:02 pm
Sorry Alan, misunderstanding, the answer about precision went to ica-cici. His routine (fit.lsp) works quite well with staircases, where I know the old and the new length exactly. - I already saw that your xyz.lsp had a reference mode, but I still had no time adding the insertblock-function and trying. I also have the "strange" rotated text example ready, but always someone working on my internet computer at work (I prefer a standalone machine for my work for safety reasons).
Randolph
11th Nov 2009, 05:36 pm
Hi Alan,
at last I had time to try your xyz.lsp together with the insertblock function. It works and makes me happy - thanxalot!
Concerning referencing, you said, I should "give it a shot". Sorry to say, my English isn't good enough to understand the meaning of that. It seems to mean, that xyz.lsp can't reference an old an a new length. This would be rather helpful, though.
I have here a little code which does this along all axis - quite simple. Could you please somehow insert this into your cool feature?
(DEFUN C:VB ()
(SETQ OBJEKTE (SSGET))
(SETQ MPUNKT (GETPOINT "\nBasispunkt :"))
(SETQ PUNKT1 (GETPOINT "\nBasis (ALT) :"))
(SETQ PUNKT2 (GETPOINT "\nBasis (NEU) :"))
(COMMAND "_OSNAP" "")
(COMMAND "_SCALE" "_SI" OBJEKTE MPUNKT "_R" MPUNKT PUNKT1 PUNKT2)
(COMMAND "_OSNAP" "_END,_INT,_MID,_CEN,_INS,_PER")
(COMMAND "_REDRAW")
(SETQ OBJEKTE NIL)
)
PS: I also add the long promised "strange text" that won't be rotated by zerorotation.lsp.
alanjt
11th Nov 2009, 06:21 pm
Hi Alan,
at last I had time to try your xyz.lsp together with the insertblock function. It works and makes me happy - thanxalot!
Concerning referencing, you said, I should "give it a shot". Sorry to say, my English isn't good enough to understand the meaning of that. It seems to mean, that xyz.lsp can't reference an old an a new length. This would be rather helpful, though.
I have here a little code which does this along all axis - quite simple. Could you please somehow insert this into your cool feature?
(DEFUN C:VB ()
(SETQ OBJEKTE (SSGET))
(SETQ MPUNKT (GETPOINT "\nBasispunkt :"))
(SETQ PUNKT1 (GETPOINT "\nBasis (ALT) :"))
(SETQ PUNKT2 (GETPOINT "\nBasis (NEU) :"))
(COMMAND "_OSNAP" "")
(COMMAND "_SCALE" "_SI" OBJEKTE MPUNKT "_R" MPUNKT PUNKT1 PUNKT2)
(COMMAND "_OSNAP" "_END,_INT,_MID,_CEN,_INS,_PER")
(COMMAND "_REDRAW")
(SETQ OBJEKTE NIL)
)
PS: I also add the long promised "strange text" that won't be rotated by zerorotation.lsp.
What I meant was, I've spent quite a bit of time of this and you still want more. However, if I have time, I'll look at it. I'm pretty swamped this week.
Thanks for posting the object. It's not ZeroRotation, your block (not text) has the attributes rotated within the block definition. You would need to fix the block.
15510
Randolph
11th Nov 2009, 06:47 pm
"What I meant was, I've spent quite a bit of time of this and you still want more."
OK, I see that I am too greedy - I don't want to be an annoyance. I thought it was some kind of sport for you, shooting with creativity every time I came up with a problem. Please, if it is stress instead, just leave it. All these are "nice to haves", but nothing I'm depending on. Same goes for the other posts I submitted today. Thank you for all your help so far!
Concerning the block, I imported it from a drawing I got. I even think it originates from another application.
alanjt
11th Nov 2009, 06:56 pm
"What I meant was, I've spent quite a bit of time of this and you still want more."
OK, I see that I am too greedy - I don't want to be an annoyance. I thought it was some kind of sport for you, shooting with creativity every time I came up with a problem. Please, if it is stress instead, just leave it. All these are "nice to haves", but nothing I'm depending on. Same goes for the other posts I submitted today. Thank you for all your help so far!
Concerning the block, I imported it from a drawing I got. I even think it originates from another application.
I'm not annoyed at all. :) I like working these out, it's a nice puzzle to ease my mind in the evenings (when I have time). More than anything, I want people to try it for themselves. I learned how to program so I wouldn't have to ask someone else. Believe me, I'll tell you if I'm annoyed. :)
Randolph
11th Nov 2009, 08:34 pm
Yeah, I learned so many things, like geometry and statics and in earlier times also programming (but not lisp) ... at the time, I have 2 luxury houses to plan. But I always try to understand the lisp routines ... promise ;)
Powered by vBulletin™ Version 4.1.2 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.