明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 810|回复: 2

[提问] 能把帮忙改为先选中图形再运执行?谢谢

[复制链接]
发表于 2020-11-3 12:26:23 | 显示全部楼层 |阅读模式
2明经币
(defun c:scc  (/ sc a b)
  (if (null oldscale) (setq oldscale 2.0))
  (initget 6)
  (setq sc (getreal (strcat "\n缩放倍数<" (rtos oldscale 2 2)">:")))
  (if (null sc) (setq sc oldscale) (setq oldscale sc))
  (while (ssget)
    (vlax-for        obj
                (vla-get-ActiveSelectionSet
                  (vla-get-ActiveDocument (vlax-get-acad-object)))
        (if (not (VL-CATCH-ALL-ERROR-P
                   (VL-CATCH-ALL-APPLY
                     'vla-GetBoundingBox
                     (list obj 'a 'b))))
          (progn
            (vla-ScaleEntity
              obj
              (vlax-3d-point
                (mapcar
                  '*
                  '(0.5 0.5 0.5)
                  (apply 'mapcar
                         (cons '+
                               (mapcar 'vlax-safearray->list
                                       (list a b))))))
              sc
              )
            )
          )
        )
    )
  (princ)
  )


最佳答案

查看完整内容

是這樣嗎? (defun c:scc (/ sc a b) (while (ssget) (if (null oldscale) (setq oldscale 2.0)) (initget 6) (setq sc (getreal (strcat "\n缩放倍数:"))) (if (null sc) (setq sc oldscale) (setq oldsc ...
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2020-11-3 12:26:24 | 显示全部楼层
是這樣嗎?
(defun c:scc  (/ sc a b)                                               
  (while (ssget)                                                      
    (if (null oldscale) (setq oldscale 2.0))                           
    (initget 6)                                                        
    (setq sc (getreal (strcat "\n缩放倍数<" (rtos oldscale 2 2)">:")))
    (if (null sc) (setq sc oldscale) (setq oldscale sc))               
    (vlax-for        obj                                               
                (vla-get-ActiveSelectionSet                           
                  (vla-get-ActiveDocument (vlax-get-acad-object)))     
        (if (not (VL-CATCH-ALL-ERROR-P                                 
                   (VL-CATCH-ALL-APPLY                                 
                     'vla-GetBoundingBox                              
                     (list obj 'a 'b))))                              
          (progn                                                      
            (vla-ScaleEntity                                          
              obj                                                      
              (vlax-3d-point                                          
                (mapcar                                                
                  '*                                                   
                  '(0.5 0.5 0.5)                                       
                  (apply 'mapcar                                       
                         (cons '+                                      
                               (mapcar 'vlax-safearray->list           
                                       (list a b))))))                 
              sc                                                      
              )                                                        
            )                                                         
          )                                                            
        )                                                              
    )                                                                  
  (princ)                                                              
  )   
                                                               
回复

使用道具 举报

 楼主| 发表于 2020-11-3 18:00:30 | 显示全部楼层
bssurvey 发表于 2020-11-3 13:54
是這樣嗎?
(defun c:scc  (/ sc a b)                                               
  (while (ssget) ...

是这样的,谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-17 14:27 , Processed in 0.176698 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表