sumitkr1108 Posted October 2 Posted October 2 i am looking for the lisp to change block properties as uniformly scaled as yes as the block is made by someone else Quote
Steven P Posted October 2 Posted October 2 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 Quote
ronjonp Posted October 2 Posted October 2 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) ) 3 Quote
sumitkr1108 Posted October 3 Author Posted October 3 (edited) @ronjonpthanks Edited October 3 by sumitkr1108 Quote
sumitkr1108 Posted October 3 Author Posted October 3 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 Quote
Recommended Posts
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.