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

Command divide option block - problem with scale of block

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
gustavobernardi
463 Views, 3 Replies

Command divide option block - problem with scale of block

Hy guys I have a lisp to subdivide a object with specific block. The block has created in centimeter units, if I insert in a file with the same units works but if the file is set in Meters units the command DIVIDE automatically aply a scale of 100 in my block and is not the result I want. how to select all blocks created during the divide and set your scales to 1,1,1 (XYZ) Excuse me if I was not clear. Thanks
3 REPLIES 3
Message 2 of 4
hmsilva
in reply to: gustavobernardi

One way

 

(setq ss (ssadd)
      obj (entlast))
("_your divide command")
(while (setq obj (entnext obj))
(ssadd obj ss)
)
(if ss
  (repeat (setq i (sslength ss))
    (setq hnd (ssname ss (setq i (1- i)))
   obj (vlax-ename->vla-object hnd)
    )
    (vla-put-XScaleFactor obj 1.0)
    (vla-put-YScaleFactor obj 1.0)
    (vla-put-ZScaleFactor obj 1.0)
  )
)

 

HTH

Henrique

EESignature

Message 3 of 4


@gustavobernardi wrote:
Hy guys I have a lisp to subdivide a object with specific block. The block has created in centimeter units, if I insert in a file with the same units works but if the file is set in Meters units the command DIVIDE automatically aply a scale of 100 in my block and is not the result I want. how to select all blocks created during the divide and set your scales to 1,1,1 (XYZ) Excuse me if I was not clear. Thanks

You can use the DIV+ command defined in the attached DivideMeasurePlus.lsp routine, which has many enhancements compared to the native Divide [and Measure, in the case of MEA+] command [see the top of the file].  One is that you can specify whatever Scale you want for Blocks [when that's what you choose to Divide or Measure with].

Kent Cooper, AIA
Message 4 of 4
gustavobernardi
in reply to: hmsilva

Thank you guys... Henrique I had to make a change in the code to work. (setq ss (ssadd) obj (entlast)) (command "._divide" elemento "block" blocofinal "YES" ndivs) (converterunidadesporfavor) (setq compensador (/ 10 scalefactorunits)) (while (setq obj (entnext obj)) (ssadd obj ss) ) (if ss (repeat (setq i (sslength ss)) (setq hnd (ssname ss (setq i (1- i))) obj (vlax-ename->vla-object hnd) ) (vla-put-XScaleFactor obj compensador) (vla-put-YScaleFactor obj compensador) (vla-put-ZScaleFactor obj compensador) ) ) scalefactorunits in the other code gives me how many times the unit is greater than the mm And Kent, great code, I will study in detail to learn a lot...

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

Post to forums  

Autodesk Design & Make Report

”Boost