Lisp code to define scale x scale y scale z of a block

Dear All,
Does anyone could help me to write a lisp code to select one or several blocks and to redefine scale x, scale y and scale z properties to a value equal to1?
Thanks for your help. BR

Comments

  • Have you tried using the Properties panel? If you select the blocks first, then you can change the x, y, and z scale from there.

    Regards,
    Jason Bourhill
    BricsCAD V22 Ultimate
    CAD Concepts

  • Note. If you can't set each x, y ,z value. Open the block and make sure the "scale uniformly" setting is set to no.
  • Anthony Apostolaros
    edited September 2022
    fst said:

    ... to select one or several blocks ...

    For the first part of your request, i.e. to select the block insertions so that you can apply the 3 scale properties to them, you can use the QuickSelect panel, which reverts to the Properties panel that Jason mentioned after the selection is finished.

    Alternatively, if your blocks have no spaces in their names, you can select all insertions of a particular block by using the attached lisp-based custom commands and typing the block name, or select all block insertions by not supplying a name. QN filters an existing selection set, and QNX creates a new selection set.

    If you want to create a custom command that does exactly what you requested, QN and/or QNX could be a start. The DXF group codes for the 3 scale properties are 41, 42, and 43. The VBA properties are XScaleFactor, YScaleFactor, and ZScaleFactor. I don't know how to make a pop-up list of block names to select from (so that you don't have to type the name and so that the blocks can have spaces in their names). But I think there are forum members for whom that would be very easy. Or ask at The Swamp.

  • fst, if you're going to write a custom command to assign scale properties to a selected set of block insertions, the two lisp functions in the attached file might serve as examples of how to:
    - filter the selection set for the type of entity you want to work on;
    - step through a selection set of such entities;
    - get a VBA Property from the first item in the set; and
    - assign a value for that VBA Property to all the items in the selection set.
  • Just a suggestion if asking for a lisp etc post in the LISP section of the forum. You may get answer faster.