乐筑天下

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

[编程交流] Associative hatch in lisp, pos

[复制链接]

59

主题

327

帖子

268

银币

后起之秀

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

铜币
295
发表于 2022-7-6 11:05:03 | 显示全部楼层 |阅读模式
In a routine I have there is a line like this:
 
  1. (command "_.hatch" "ANSI32" 50.0 0.0 "_l" "")
 
These hatches stay not associative even though I have set the variable "HPASSOC" to 1. I need them to be associative.
 
So I tried manually on the command bar, how to hatch the last created entity (if hatchable like a rectangle):
 
  1. (command "_.hatch" "A" "A" "Yes" "" "P" "ANSI32" 50.0 0.0 "S" "_L" "")
 
But that doesn't seem to work...
Any idea how to make the hatch associative?
 
Thanks in advance for helping me out once again.
 
(ps.: I have been here and that doe not help, it still disfunctions)
回复

使用道具 举报

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2022-7-6 11:58:53 | 显示全部楼层
Give this a try:
 
  1. (defun c:hatchit (/ doc e h o) (if (and (setq e (car (entsel "\nSelect something to hatch: ")))   (setq o (vlax-ename->vla-object e))   (setq doc (vla-get-activedocument (vlax-get-acad-object)))   (setq h (vlax-invoke             (if (= (getvar 'cvport) 1)               (vla-get-paperspace doc)               (vla-get-modelspace doc)             )             'addhatch             achatchobject             (getvar 'hpname)             :vlax-true           )   )   (not        (vl-catch-all-error-p          (vl-catch-all-apply 'vlax-invoke (list h 'appendouterloop (list o)))        )   )     )   (progn (vlax-put h 'patternangle (getvar 'hpang))   (vlax-put h 'patternscale (getvar 'hpscale))   (setq e (vlax-vla-object->ename h))   (entmod (subst (cons 8 (strcat (vla-get-layer o) "-hatch"))                  (assoc 8 (entget e))                  (entget e)           )   )   (vla-evaluate h)   ) ) (princ))
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 12:21:38 | 显示全部楼层
Try this out (tested on A2010)
  1. (command "-bhatch" "_AN" "_Y" "_S" (entsel "\nSelect contour >> ") "" "_P" "ANSI32" "" "" "")
 
~'J'~
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 11:34 , Processed in 0.585299 second(s), 58 queries .

© 2020-2025 乐筑天下

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