乐筑天下

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

[编程交流] 试图得到这个Mleaderstyl

[复制链接]

78

主题

207

帖子

129

银币

后起之秀

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

铜币
395
发表于 2022-7-5 16:16:43 | 显示全部楼层 |阅读模式
我在Augi论坛上从Fixo中找到了这个创建MleaderStyle的线程
 
我试图修改它以满足我的需要,但在这个过程中,我把ScaleFactor部分搞砸了。首先,我删除了文本/引线颜色的[2]个参数。我硬编码了它们,因为它们在不同的样式中是相同的。我尝试为scale(MLDScale)添加一个参数。我进入比例因子区域,输入MLDscale。lisp运行并创建MLeaderStyle,但比例为arye。
 
当我进入时
 
  1. (Make_mleader_style "test" 10.0)

 
创建样式,比例为1877221544.0000
 
这是修改后的代码
 
  1. ;; original code by VVA
  2. (defun make_mleader_style        (mleaderstylename
  3.                          MLDScale                           [color="red"] ;;added/removed arguments[/color]
  4.                          /
  5.                          adoc
  6.                          mldrdict
  7.                          newldrstyle
  8.                          objcolor
  9.                         )
  10. (vl-load-com)
  11. (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
  12. (setq        mldrdict
  13. (vla-item (vla-get-dictionaries adoc) "ACAD_MLEADERSTYLE")
  14. ) ;_ end of setq
  15. (setq        newldrstyle
  16. (vlax-invoke
  17.    mldrdict
  18.    'addobject
  19.    mleaderstylename
  20.    "AcDbMLeaderStyle"
  21. ) ;_ end of vlax-invoke
  22. ) ;_ end of setq
  23. (setq        objcolor (vla-getinterfaceobject
  24.            (vlax-get-acad-object)
  25.            (strcat "AutoCAD.AcCmColor."
  26.                    (substr (getvar "acadver") 1 2)
  27.            ) ;_ end of strcat
  28.          ) ;_ end of vla-getinterfaceobject
  29. ) ;_ end of setq                                          [color="red"] ;;this is where I override the colors[/color]
  30. (vla-put-colorindex objcolor 2)                       [color="red"];;I really don't know what's going on here. i"m trying to understand[/color]
  31. (vla-put-textcolor newldrstyle objcolor)
  32. (vla-put-colorindex objcolor 0)
  33. (vla-put-leaderlinecolor newldrstyle objcolor)
  34. (foreach item
  35.    (list
  36.      '("AlignSpace" 4)
  37.      '("ArrowSize" 0.125)
  38.      '("BitFlags" 0)
  39.      '("BlockConnectionType" 1)
  40.      '("BlockRotation" 0.0)
  41.      '("BlockScale" 1.0)
  42.      '("BreakSize" 0.125)
  43.      '("ContentType" 2)                ;mtext
  44.      '("Description" "My Style Description")
  45.      '("DoglegLength" 1.25)
  46.      '("DrawLeaderOrderType" 0)
  47.      '("DrawMLeaderOrderType" 1)
  48.      '("EnableBlockRotation" -1)
  49.      '("EnableBlockScale" -1)
  50.      '("EnableDogleg" -1)
  51.      '("EnableFrameText" 0)
  52.      '("EnableLanding" -1)
  53.      '("FirstSegmentAngleConstraint" 0)
  54.      (list "LandingGap"
  55.            (vla-get-landinggap (vla-item mldrdict "Standard"))
  56.      ) ;_ end of list
  57.      '("LeaderLineType" 1)
  58.      '("LeaderLineTypeId" "ByLayer")
  59.      '("LeaderLineTypeId" "ByLayer")
  60.      '("LeaderLineWeight" -3)
  61.      '("MaxLeaderSegmentsPoints" 2)
  62.      '("ScaleFactor" MLDScale)                         [color="red"];;This is where I added the argument MLDScale[/color]
  63.      '("SecondSegmentAngleConstraint" 0)
  64.      '("TextAlignmentType" 0)
  65.      '("TextAngleType" 0)
  66.      '("TextHeight" 1.5)
  67.      '("TextLeftAttachmentType" 4) ;original 3
  68.      '("TextRightAttachmentType" 4);original 3
  69.      '("TextString" "Default\\PText")
  70.      '("TextStyle" "STANDARD")
  71.    ) ;_ end of list
  72.    (vlax-put newldrstyle (car item) (cadr item))
  73. ) ;_ end of foreach
  74. newldrstyle
  75. ) ;_ end of defun

 
我哪里出错了?
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 16:34:52 | 显示全部楼层
撇号/引号传递变量而不进行评估,
 
所以基本上:
  1. '("ScaleFactor" MLDScale) ;;This is where I added the argument MLDScale

 
就像做:
  1. (list "ScaleFactor" 'MLDScale)

 
所以你实际上必须使用:
  1. (list "ScaleFactor" MLDScale) ;;This is where I added the argument MLDScale
回复

使用道具 举报

78

主题

207

帖子

129

银币

后起之秀

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

铜币
395
发表于 2022-7-5 16:45:22 | 显示全部楼层
我想我发现了我的问题。我做了一些调试,注意到在ScaleFactor的行中,在我的手表窗口中,MLDScale从未接受我的论点。
 
所以名单
 
  1. '("ScaleFactor" MLDSCALE)

 
评估为
 
  1. ("ScaleFactor" MLDSCALE)

 

 
  1. ("ScaleFactor" 10.0)

 
我在控制台中测试了这个
 
  1. _$ (setq test 13.0)
  2. 13.0
  3. _$ '("a" test)
  4. ("a" TEST)
  5. _$

 
我不知道怎么解决这个问题
回复

使用道具 举报

BKT

1

主题

124

帖子

123

银币

初来乍到

Rank: 1

铜币
7
发表于 2022-7-5 16:59:25 | 显示全部楼层
你试过Grrr在第2篇文章中展示的内容吗?
 
  1. (list "ScaleFactor" MLDScale)
回复

使用道具 举报

78

主题

207

帖子

129

银币

后起之秀

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

铜币
395
发表于 2022-7-5 17:13:38 | 显示全部楼层
我在李的网站上找到了答案。我真是个新手。我以前读过这篇文章,我完全忘记了。我希望我的失败能帮助索蒙·埃利斯。
 
李的撇号
 
我刚刚使用了list函数,它工作得很好。请参阅下面的我的控制台测试
 
  1. _$ (setq test 13.0)
  2. 13.0
  3. _$ '("A" TEST)   ;;this evaluates literally
  4. ("A" TEST)
  5. _$ (list "a" test)  ;;the list function will evaluate the symbol
  6. ("a" 13.0)
  7. _$

 
李-麦克解释得更好。我
回复

使用道具 举报

78

主题

207

帖子

129

银币

后起之秀

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

铜币
395
发表于 2022-7-5 17:28:33 | 显示全部楼层
 
DOH!我在回复编辑的时候没有注意到你的回复。你基本上是对的。无论如何,谢谢!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-9 18:48 , Processed in 0.418710 second(s), 64 queries .

© 2020-2025 乐筑天下

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