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

Scale Uniformly

14 REPLIES 14
Reply
Message 1 of 15
Anonymous
954 Views, 14 Replies

Scale Uniformly

ok i give up trying to find the answer, i don't think anybody else ever tried this...
what i want to do, is to set a block that is pre-existing in the drawing that isn't set to scale uniformly to scale uniformly, i don't exacly know why, the scale command would probably be faster, but i think it would just be nice to have that set in some of the old blocks that i keep coming across. any ideas would be awesome, i've been trying to figure it out for a while and it's just not working.
14 REPLIES 14
Message 2 of 15
Anonymous
in reply to: Anonymous

I don't quite understand what you want, so let me show some examples of what
I think you may be saying.
ie 1 (x3)
x = 1 now = 3
y = 2 now = 6
z = 0 now = 0

ie 2 (x3)
x = 1 now = 3
y = 2 now = 3
z = 0 now = 3

Am I close on either one?

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:5259630@discussion.autodesk.com...
ok i give up trying to find the answer, i don't think anybody else ever
tried this...
what i want to do, is to set a block that is pre-existing in the drawing
that isn't set to scale uniformly to scale uniformly, i don't exacly know
why, the scale command would probably be faster, but i think it would just
be nice to have that set in some of the old blocks that i keep coming
across. any ideas would be awesome, i've been trying to figure it out for a
while and it's just not working.
Message 3 of 15
Anonymous
in reply to: Anonymous

T.Willey wrote:
> I don't quite understand what you want, so let me show some examples
> of what I think you may be saying.


My guess.

> ie 2 (x3)
> x = 1 now = 3
> y = 2 now = 3
> z = 0 now = 3
>
Message 4 of 15
Anonymous
in reply to: Anonymous

no, you know when you go into the block editor and in the properties thing you can set the "Scale Uniformly" to yes or no, i want to do the same thing with lisp.

i just made a lisp routing to scle blocks thru entmod stuff, but i really just want that scale uniformly thing to be set to yes in all my blocks, it's so rare that i would not scale a block uniformly that it should be the option, not the default. so i want to automate that in the drawings when i open them, but first i need to figure out where that little bugger lives so i can catch him and mod him B]
Message 5 of 15
Anonymous
in reply to: Anonymous

(vlax-for blk
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(vla-put-blockscaling blk acUniform)
)

wrote in message news:5259657@discussion.autodesk.com...
no, you know when you go into the block editor and in the properties thing
you can set the "Scale Uniformly" to yes or no, i want to do the same thing
with lisp.

i just made a lisp routing to scle blocks thru entmod stuff, but i really
just want that scale uniformly thing to be set to yes in all my blocks, it's
so rare that i would not scale a block uniformly that it should be the
option, not the default. so i want to automate that in the drawings when i
open them, but first i need to figure out where that little bugger lives so
i can catch him and mod him B]
Message 6 of 15
Anonymous
in reply to: Anonymous

ok, i'm retarded, i can't get it to work
Message 7 of 15
tader1
in reply to: Anonymous

what I do is use the filter command then, "add selected object" then remove all things that are unique to that object, ie. coordinates, etc- then I select all. Then I use the properties dialogue box "ctrl+1" and u can change the scale to whatever you like there and many other attributes.
Message 8 of 15
Anonymous
in reply to: Anonymous

yeah, and that is one way that i do it when i want to do a global change like that, but what i'm saying isn't to do a global scaling of all the blocks, i just want to be able to highlight the few blocks that need to be scaled and it's just easier to change a single value in the properties dialoge than to enter the same one three times. i'm mostly just being lazy, or anal, whichever it is, i did come up with a little routine out of this, most of the time i'm just scaling blocks dow from 1 to 0.8:

(defun c:sd ()
(while
(progn
(princ "\nScale Down ")
(setq en1 nil
en2 nil
en1 (entget (setq en (car (entsel))))
en2 (cdr (assoc 0 en1))
)
(while (/= en2 "INSERT")
(setq en1 nil
en2 nil
en1 (entget (car (entsel)))
en2 (cdr (assoc 0 en1))
)
)
(setq en1 (subst (cons 41 0.8) (assoc 41 en1) en1)
en1 (subst (cons 42 0.8) (assoc 42 en1) en1)
en1 (subst (cons 43 0.8) (assoc 43 en1) en1)
)
(entmod en1)
(entupd en)
)
)
(princ)
)
Message 9 of 15
tader1
in reply to: Anonymous

lisp is cooler too
Message 10 of 15
Anonymous
in reply to: Anonymous

i agree, lisp rocks!!
Message 11 of 15
Tom Smith
in reply to: Anonymous

There's no need to run entsel twice, and your variables should be declared local.

[code]
(defun c:sd (/ pick ename edata)
(princ "\nScale Down ")
(while (not pick)
(setq pick (entsel)))
(setq
ename (car pick)
edata (entget ename))
(entmod
(subst '(41 . 0.8) (assoc 41 edata)
(subst '(42 . 0.8) (assoc 42 edata)
(subst '(43 . 0.8) (assoc 43 edata) edata))))
(entupd ename)
(princ))
[/code]
Message 12 of 15
Anonymous
in reply to: Anonymous

i never really understood what the brackets after the defun meant, but now i think i understand, thanks! that should make things a bit easier.
Message 13 of 15
Tom Smith
in reply to: Anonymous

It's covered in the Developer documentation under "Using defun to Define a Function." The items listed after the slash are variables which are local to the function. Meaning that they are initally nil, and are shielded from the rest of the Acad session.
Message 14 of 15
Anonymous
in reply to: Anonymous

guess i probably could have read that, but mostly i leared by just reading over other peoples routines so some stuff that i do i'm not sure why i do it i just do, but i mosly understand what's going on now. at some point in time i must have learned that my routines were working without adding all the variables at the baginnning an then just stopped defining them. thanks for the bit of education.
Message 15 of 15
Anonymous
in reply to: Anonymous

so i finally got this to work using a macro instead. below is my solution for anyone who would like to do the same thing...

Lisp part:

(defun c:bsu ()
(princ "\nBlock Scale Uniformly\n")
(vl-vbaload (strcat home "/vba/timVBA.dvb"))
(vl-vbarun "block_scale_uniformly")
(princ "\nFinally!!\n")
(princ)
)

VBA Part:

Public Sub block_scale_uniformly()

Dim block As AcadBlock
Dim entity As AcadEntity

For Each block In ThisDrawing.Blocks
If "*Model_Space" = block.Name Or "*MODEL_SPACE" = block.Name Then
GoTo nextblock
Else
If "*Paper_Space" = block.Name Or "*PAPER_SPACE" = block.Name Then
GoTo nextblock
Else
block.BlockScaling = acUniform
End If
End If
nextblock:
Next block

End Sub

let me know if this is any help to anyone!

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

Post to forums  

Autodesk Design & Make Report

”Boost