乐筑天下

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

[编程交流] 用于创建多重引线Styl的LISP

[复制链接]

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2022-7-5 16:53:56 | 显示全部楼层
它将始终返回nil(命令“_.insert”“fullpathtotemplate”nil)。。如果模板不在搜索路径中,请确保将完整路径放在模板上。
回复

使用道具 举报

32

主题

430

帖子

423

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
150
发表于 2022-7-5 16:59:46 | 显示全部楼层
您好,请您上传一个示例dwg,并在这里显示mleader?
 
很容易将所有属性复制到新的MLEADER样式。
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 17:04:31 | 显示全部楼层
 
 
这是我关于这个想法的0.02美元:
 
  1. ; s - Source VLA-OBJECT (graphical/non-graphical)
  2. ; d - Destination VLA-OBJECT (graphical/non-graphical)
  3. ; ps - predefined properties list to use, if nil the (atoms-family) properties approach will be used
  4. ; aps - properties list to include for matching, since (atoms-family) is missing some of them
  5. ; rps - properties list to remove from matching
  6. ; Returns: assoc list of (<PropertyName> <MatchedValue>) for the error-free assigned properties
  7. ; Wanna credits?: Lee Mac, Michael Puckett
  8. (defun _MatchProps ( s d ps aps rps / TrapT )
  9. (cond
  10.    ( (or (vl-some '(lambda (x) (not (eq 'VLA-OBJECT (type x)))) (list s d)) (not (vlax-read-enabled-p s)) (not (vlax-write-enabled-p d))) nil)
  11.    (
  12.      (and
  13.        (if ps ; determine predefined properties to use or (atoms-family)
  14.          (setq ps (mapcar '(lambda (p) (cond ((eq 'SYM (type p)) (vl-symbol-name p)) ((eq 'STR (type p)) (strcase p)))) ps))
  15.          (setq ps (apply 'append (mapcar '(lambda (x) (if (wcmatch (setq x (strcase x)) "VLA-PUT-*") (list (vl-string-left-trim "VLA-PUT-" x)))) (atoms-family 1))))
  16.        )
  17.        (setq ps (append (if aps (mapcar '(lambda (p) (cond ((eq 'SYM (type p)) (vl-symbol-name p)) ((eq 'STR (type p)) (strcase p)))) aps)) ps)) ; additional
  18.        (setq ps (apply 'append (mapcar '(lambda (p) (if (vl-every '(lambda (x) (vlax-property-available-p x p t)) (list s d)) (list p))) ps))) ; check valid props
  19.        (cond ; check for removal
  20.          (rps
  21.            (setq rps (apply 'append (mapcar '(lambda (p) (cond ((eq 'SYM (type p)) (list (vl-symbol-name p))) ((eq 'STR (type p)) (list (strcase p))))) rps)))
  22.            (setq ps (vl-remove-if '(lambda (p) (member p rps)) ps))
  23.          )
  24.          ( ps )
  25.        )
  26.      ); and
  27.      (setq TrapT ; Traps the evaluation only: returns nil only if an error occured, else the value or T
  28.        (lambda (f args / r) (cond ( (vl-catch-all-error-p (setq r (vl-catch-all-apply f args))) (prompt (strcat "\nError: " (vl-catch-all-error-message r))) ) (r) ((not r)) ) )
  29.      ); setq TrapT
  30.      (mapcar '(lambda (p / v) (cond ( (not (setq v (TrapT 'vlax-get-property (list s p)))) v) ( (not (TrapT 'vlax-put-property (list d p v))) nil) ( (list p v) ) ) ) ps)
  31.    )
  32. ); cond
  33. ); defun _MatchProps

 
然后
 
  1. (defun MatchMleaderStyleProps ( snm dnm / coll )
  2. (setq coll (vla-item (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))
  3. (_MatchProps (vl-catch-all-apply 'vla-item (list coll snm)) (vl-catch-all-apply 'vla-item (list coll dnm))
  4.    '(
  5.      alignspace annotative arrowsize arrowsymbol bitflags block blockcolor
  6.      blockconnectiontype blockrotation blockscale breaksize contenttype description
  7.      dogleglength drawleaderordertype drawmleaderordertype  enableblockrotation
  8.      enableblockscale  enabledogleg enableframetext enablelanding firstsegmentangleconstraint
  9.      landinggap leaderlinecolor leaderlinetype leaderlinetypeid leaderlineweight
  10.      maxleadersegmentspoints overwritepropchanged  scalefactor secondsegmentangleconstraint
  11.      textalignmenttype textangletype textattachmentdirection textbottomattachmenttype
  12.      textcolor textheight textleftattachmenttype  textrightattachmenttype
  13.      textstring textstyle texttopattachmenttype
  14.    ); list
  15.    nil nil
  16. )
  17. ); defun

 
示例调用:
 
  1. (MatchMleaderStyleProps "MySourceMleaderStyle" "MyDestinationMleaderStyle")
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 20:58 , Processed in 0.405977 second(s), 56 queries .

© 2020-2025 乐筑天下

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