• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

bring to 0 the variable insunits in the blocks of a drawing

  • Thread starter Thread starter x11start
  • Start date Start date

x11start

Guest
the variable insunits if left to value 0, allows to import blocks between the various designs keeping the scale of the block itself, the scale with which it was created.
if instead if in the design it is set to a different value (e.g. 4 representing the mm), and a block is created, when the latter is inserted in another design where the variable is placed at a different value.... the block is scaled.
surely the thing is very useful if the lisp were created taking into account, vice versa the thing becomes annoying as the recalled blocks are scaled.

I wonder if it was possible to create a lisp able to place at 0 .... or however to vary all the blocks of a design at the same time, without having to explode and recreate the blocks.

I suppose this is a hidden group code who knows where... .

thanks for the help
 
insunits is a variable stored in the drawing, not in the block, so you will never find it among the block groups.
via lisp, you get such veriable through (getvar) and sect through (setvar).
the fact is that if you create an external block (a dwg that calls from another dwg) obviously the dwg of the block has its variable stored within the file, which is not a variable linked to the single block, but to the single file.
is the value of the variable (of the design) saved when you created the block (as an external dwg), I don't know if I explained.
You should open all the dwgs of the blocks you have, set insunits to zero and save them, all there.
 
But if you look at the properties inside the block there is that of the units that is editable
 
I had never placed the problem because in "millemila" years of career (!) my blocks had always imported them between the various designs keeping the scale.
right now I tried to create a 100x100 square within a cube design I put insunits = 4, then I made a block.; I selected it and copied it with ctrl+c.
I entered another dwg where the variable is placed at 0, and I glued the block.

the glued block has maintained the size 100x100.

I did the same operation in the opposite direction... and also in this case the scale is not varied.. .

at this point I don't understand why the other blocks stop... .
 
to know the value of insunits, or rather the value of units of a block:(vla-get-insunits (vlax-ename->vla-object (car (entsel)))returns "millimeters", "centimeters" or "meters"

to know the scale ratio between the block unit and dwg insunits(vla-get-insunitsfactor (vlax-ename->vla-object (car (entsel)))re-establishment ad es. 0.01 if it blocking imported is in centimeters and insunits = 6 (meters)

this value serves to know how much to scale the block to relate it to the design in which it was imported, after which you can assign to all blocks the current value of insunits with: (vla-get-blocks (vla-get-active document (vla-get-acad object)))
(fla-put-units blk (getvar 'insunits))
)
should we know how they were inserted, or scaled to uniform them with the rest of the design or without changing the original scale?
 
thanks to all .. and thanks to gp! I just have to create a sub that reviews the interested blocks, before inserting them into the drawing.
 
So basically, I think I will just make sure that the new blocks inserted become in the right scale.... avoiding to "force" the internal scale of each.
 
applying gp tips, I created this lisp that allows you to assign to all the blocks currently used in the drawing, the current value of insunits.
I'll explain. .
if by means of the unit command, we set to work in meters and intend to insert a block that had been created in centimeters, entering it with the values of scale 1 (for all axes), in fact the block will be scaled of 100 times: very unpleasant thing if these insertions happen through a lisp.

well: if we launch insunit.lsp, all the blocks present in the drawing will be transformed into meters (or whatever the value currently used), so there will be no more problems to launch lisp commands, which insert blocks (as long as they have already been loaded into the drawing).

my advice however is to set the insunits variable to 0 (without unit) which makes the blocks more "universal".

Anyway, thanks to the gp tips now it is no longer necessary to think that you have to explode and recreate all the blocks for not having problems with stairs.

not to be confused:
insunits-- is the system variable that can also be changed with the unit command

insunit ------> is the lisp that I attach to this message and serves to uniform the blocks
 

Attachments

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top