乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 21|回复: 19

[编程交流] Why I can't change the Ha

[复制链接]

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 20:26:14 | 显示全部楼层 |阅读模式
I don't know why this routine can't change the hatch scale ,  Someone can help ?
 
  1. (defun ZMH_Change_Hatch_Scale()       (setq i 0)       (repeat (sslength ss)               (setq ent (entget (ssname ss i))                       ent (subst (cons 41 bl) (assoc 41 ent) ent)               )               (entmod ent)               (setq i (1+ i))       );repeat       (princ (strcat "\nModify Scale[ZOOM IN(Q)/ZOOM OUT(W)/INPUT(E)]:")))(defun c:test (/ hpsc o_DIMZIN ss s1 i bl bb mouse a aa) (setvar "cmdecho" 0) (princ "Modify Hatch Scale") (setq hpsc (getvar "hpscale")) (setq o_DIMZIN (getvar "DIMZIN")) (setvar "DIMZIN"  (command "_.undo" "_group") (setq ss (ssget '((0 . "hatch")))       bl (cdr (assoc 41 (entget (ssname ss 0))))  ) (if bl   (progn     (princ (strcat "\nModify Scale[ZOOM IN(Q)/ZOOM OUT(W)/INPUT(E)]:"))     (setq bb T)     (while bb       (setq mouse (grread T 12 0))       (setq a (car mouse) aa (cadr mouse))       (cond         ((and (= 2 a) (or (= 113 aa) (= 81 aa)))           (progn (setq bl (* bl 1.2)) (ZMH_Change_Hatch_Scale))         )         ((and (= 2 a) (or (= 119 aa) (= 87 aa)))           (progn (setq bl (/ bl 1.2)) (ZMH_Change_Hatch_Scale))         )         ((and (= 2 a) (or (= 101 aa) (= 69 aa)))           (progn (setq bl (getreal "\nSpecify Hatch Scale:")) (ZMH_Change_Hatch_Scale))                                 )         ((or (= 25 a) (= 11 a)             (and (= a 2) (= aa 13))            (and (= a 2) (= aa 32))          )           (setq bb nil)         )       );cond     );while   );progn );if (setvar "DIMZIN" o_DIMZIN) (command "_.undo" "_end") (princ))
回复

使用道具 举报

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 20:30:06 | 显示全部楼层
  1. (defun ZMH_Change_Hatch_Scale() (setq i -1) (while (setq s1 (ssname ss (setq i (1+ i))))   (vla-put-PatternScale (vlax-ename->vla-object s1) (rtos bl 2 3)) );while (setvar "hpscale" hpsc) (princ (strcat "\nModify Scale[ZOOM IN(Q)/ZOOM OUT(W)/INPUT(E)]:")))
 
I mean :
I use "properties" can see scale is changed. But Hatch no change ! why???   Use "regenall"  , is same!
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-5 20:33:56 | 显示全部楼层
If the type of the Hatch object is User_definied , so you can not change the scale .
To check that out , just select the hatch object and right click on the object and choose Properties and from that pattern check the type property of the object .
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:36:12 | 显示全部楼层
if hatchscale modified in property window, i noticed hatchspace also updated automatically ,natural behavior?
  1. (defun chsc (ss sc / i) (if (and ss (not (zerop sc)))   (repeat (setq i (sslength ss))     (if (setq e (ssname ss (setq i (1- i))))(mapcar        ''((a b) (vlax-put (vlax-ename->vla-object e) a b))        '("PatternScale" "PatternSpace")        (list sc sc)        ) ;_ end of mapcar) ;_ end of if     ) ;_ end of repeat   ) ;_ end of if sc ) ;_ end of defun;test  ([color="red"]chsc[/color] (ssget ":L" '((0 . "HATCH"))) 2.5)
 
not tested in user defined.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-5 20:41:09 | 显示全部楼层
hanhphuc , you have an extra if function that is not need in my opinion in your sub-function .
回复

使用道具 举报

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 20:43:39 | 显示全部楼层
 
Hi   Tharwat ,
 
is not "User_definied"  , is "predefined"
回复

使用道具 举报

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 20:47:36 | 显示全部楼层
 
Hi Hanhphuc.
can you give a integral routine ? like this : Modify Scale[ZOOM IN(Q)/ZOOM OUT(W)/INPUT(E)]
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:51:31 | 显示全部楼层
 
Debugging
 
In fact there's a bug I couldn't resolve :
If the hatch is outside its boundary it won't update as desired.
Need to move manually to different position then it visually updated.
Weird. vla-regen or vla-update can't help
</p></blockquote>
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-5 20:52:18 | 显示全部楼层
 
What do you mean by hatchspace hanhphuc?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-5 20:57:27 | 显示全部楼层
Might be PatternSpace
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 09:05 , Processed in 0.934043 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表