Jump to content

lisp to make the all selected block property as uniformly scale to yes if it is no


Recommended Posts

Posted

i am looking for the lisp to change block properties as uniformly scaled as yes as the block is made by someone else 

Posted

What are your abilities with LISP like? a few hints or tips that might set you on the right track, and assuming it is x, y, z scale for the block to set to a scale factor of '1'

 

You might use (ssget '((0 . "INSERT"))) to select blocks or (ssget '((2 . "BlockName"))) to select a named block (see https://lee-mac.com/ssget.html)

You might loop through the selection set however you want to and assess each selected block

If you get the entity name from each selection set item (ssname nth 'Selection set'), you can ent mod that to set the scale factors (https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-C7D27797-247E-49B9-937C-0D8C58F4C832)

Modify entity codes 41, 42 and 43 to the scale factor you want to use for a block.

 

That should modify a block in the drawing to whatever scle factor you want,

 

You could try this line to insert a block if you know its details. I think block name below can be a name that is currently defined in the drawing ( "MyBlock") or it can be a filepath to a drawing to insert ("C:\Users\\Me\\Blocks\\MyBlock.dwg") where I think you'll need to use double \\ in the filepath

 

  (setq InsertedBlock
    (entmakex (list
      '(0 . "INSERT")
      (cons 2 BlockName) ; a string
      (cons 10 insertpoint) ; a point
      (cons 41 xscale)   ; a number
      (cons 42 yscale)   ; a number
      (cons 43 zscale)   ; a number
      (cons 50 rotation) ; a number, rads
    )) ; end list, end entmakex
  )    ; end setq

 

Posted

This should change all block definitions to scale uniformly.

(defun c:foo nil
  (vlax-for b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (and (= 0 (vlax-get b 'isxref) (vlax-get b 'islayout))
	 (vl-catch-all-apply 'vla-put-blockscaling (list b acuniform))
    )
  )
  (princ)
)
  • Like 3
Posted (edited)

@ronjonpthanks 

Edited by sumitkr1108
Posted
10 hours ago, ronjonp said:

This should change all block definitions to scale uniformly.

(defun c:foo nil
  (vlax-for b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (and (= 0 (vlax-get b 'isxref) (vlax-get b 'islayout))
	 (vl-catch-all-apply 'vla-put-blockscaling (list b acuniform))
    )
  )
  (princ)
)

@ronjonpthanks for the reply but i want that i should select the block may be more than one my window selection method

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...