建立多重引线样式,卡在字体颜色那里了
在2014上运行,卡在了文字及线型颜色这里(SETQ key5 (GETVAR "DIMASZ"))(if (setq obj (AddMLeaderStyle nam1))
(progn (vla-put-textstyle obj"引线");文字样式
(vla-put-textheight obj 3.5);文字高度
(vla-put-arrowsize obj key5);箭头大小
(vla-put-ArrowSymbol obj "_Dot" );箭头符号样式-圆点
(vla-put-BreakSize obj 0.2);引线打断大小
(vla-put-ContentType obj acMTextContent);引线类型-acBlockContent=块acMTextContent=多行文字acNoneContent =无
(vla-put-DrawMLeaderOrderType obj acDrawLeaderTailFirst);acDrawLeaderTailFirst=文字优先acDrawLeaderHeadFirst=基线优先
(vla-put-FirstSegmentAngleConstraint obj 4);第一段角度60度
(vla-put-LandingGap obj 0.8);文字附着间隙
;(vla-put-LeaderLineColor obj acByLayer);引线颜色(值不正确)
(vla-put-LeaderLinetype obj 1);引线线型
(vla-put-LeaderLineWeight obj -1);引线宽度
(vla-put-LeaderLineTypeId obj "ByLayer");引线类型iD
(vla-put-MaxLeaderSegmentsPoints obj 2);最大引线点数
;(vla-put-OverwritePropChanged obj False);覆盖特性值True,False(说没这个参数)
(vla-put-SecondSegmentAngleConstraint Property obj 6);第二段角度90度
(vla-put-TextAlignmentType obj 0);文字对齐类型acCenterAlignment=中acLeftAlignment=左acRightAlignment=右
(vla-put-TextAngleType obj 1);文字角度(这个值应该设置什么?)
(vla-put-TextAttachmentDirection obj 0);文字附着方向acAttachmentHorizontal=水平acAttachmentVertical=垂直
(vla-put-TextBottomAttachmentType obj 0);底部文字附着方向acAttachmentCenter=居中acAttachmentLinedCenter=下划线并居中
;(vla-put-TextColor obj acYellow);文字颜色(值不正确,但查询应该是这个值,不知为什么)
(vla-put-TextLeftAttachmentType obj 7);左对齐位置文字连接位置类型
(vla-put-TextRightAttachmentType obj 7);右对齐位置文字连接位置类型
(vla-put-TextTopAttachmentType obj 0);顶部文字附着方向acAttachmentCenter=居中acAttachmentLinedCenter=下划线并居中
(vla-put-ScaleFactor obj scal)
(setvar "CMLEADERSTYLE" nam1)
)
)通过设置了样式后,使用(vlax-dump-object (vla-item (vla-item (vlax-ename->vla-object (namedobjdict))"ACAD_MLEADERSTYLE") "standard") t)
获取了特征码,如下:
; IAcadMLeaderStyle: AutoCAD 多重引线样式界面
;特性值:
; AlignSpace = 4.0
; Annotative = 0
; Application (RO) = #<VLA-OBJECT IAcadApplication 000000013fcfc910>
; ArrowSize = 1.0
; ArrowSymbol = "_Dot"
; BitFlags = 0
; Block = ""
; BlockColor = #<VLA-OBJECT IAcadAcCmColor 000000002c9fb3f0>
; BlockConnectionType = 0
; BlockRotation = 0.0
; BlockScale = 1.0
; BreakSize = 0.125
; ContentType = 2
; Description = "Standard"
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000002c69af88>
; DoglegLength = 2.0
; DrawLeaderOrderType = 0
; DrawMLeaderOrderType = 1
; EnableBlockRotation = -1
; EnableBlockScale = -1
; EnableDogleg = -1
; EnableFrameText = 0
; EnableLanding = -1
; FirstSegmentAngleConstraint = 4
; Handle (RO) = "131"
; HasExtensionDictionary (RO) = 0
; LandingGap = 0.8
; LeaderLineColor = #<VLA-OBJECT IAcadAcCmColor 000000002c9fab50>
; LeaderLinetype = 1
; LeaderLineTypeId = "ByLayer"
; LeaderLineWeight = -1
; MaxLeaderSegmentsPoints = 2
; Name = "Standard"
; ObjectID (RO) = 43
; ObjectID32 (RO) = 43
; ObjectName (RO) = "AcDbMLeaderStyle"
; OverwritePropChanged (RO) = -1
; OwnerID (RO) = 44
; OwnerID32 (RO) = 44
; ScaleFactor = 20.0
; SecondSegmentAngleConstraint = 6
; TextAlignmentType = 0
; TextAngleType = 1
; TextAttachmentDirection = 0
; TextBottomAttachmentType = 0
; TextColor = #<VLA-OBJECT IAcadAcCmColor 000000002c9fb090>
; TextHeight = 4.0
; TextLeftAttachmentType = 7
; TextRightAttachmentType = 7
; TextString = ""
; TextStyle = "Standard"
; TextTopAttachmentType = 0
;支持的方法:
; Delete ()
; GetExtensionDictionary ()
; GetXData (3)
; SetXData (2)
其余的参数值能直接填写,但这个TextColor = #<VLA-OBJECT IAcadAcCmColor 000000002c9fb090>,不知道怎样使用,我需要字体颜色是2号色
(progn
(if (not (setq col_num (acad_colordlg 256 )))(setq col_num 256))
(setq xobj (vlax-ename->vla-object (car(entsel))))
(setq mlstyle(vla-item (vla-item (vlax-ename->vla-object (namedobjdict))"ACAD_MLEADERSTYLE") "Mls_Mtxt"));样式名自已改
(setq oCol (vlax-create-object (strcat "autocad.accmcolor." (substr (getvar 'acadver) 1 2))))
(vla-put-ColorIndex oCol 256)
(vla-put-textcolor mlstyle oCol) ;多线的字体颜色随层,用于后面的vla-put-Color来修改
(vla-put-ColorIndex oCol col_num)
(vla-put-LeaderLineColor xobj oCol) ;引线的颜色
(vla-put-Color xobj col_num)
)
yfywk 发表于 2015-4-27 16:45
setq color (vla-GetInte**ceObject (vlax-get-acad-object) "AutoCAD.AcCmColor.19"));我在2014上用就写19 ...
(setq oCol (vlax-create-object (strcat "autocad.accmcolor." (substr (getvar 'acadver) 1 2))));:vlax-true
(vla-put-ColorIndex oCol acGreen)
(vla-put-LeaderLineColor oNewMLS oCol)
这样子就不用管版本号了 感谢前面楼主提供的源码,经实践总结如下:
①MLeader样式建立时,要注意把文字颜色设成256,即随层
相关思路是把引线颜色和文字颜色分开
②用前面楼主的 vla-put-LeaderLineColor更改引线颜色(注意颜色值要转换)。
③用vla-put-Color更改文字颜色(注意颜色值直接用0-256即可) 先谢谢你回答了我的问题
你的问题,建议你可以参考一下单行文字或多行文的字体颜色,应该是一样的吧 祝楼主研究成功 setq color (vla-GetInte**ceObject (vlax-get-acad-object) "AutoCAD.AcCmColor.19"));我在2014上用就写19
(vla-setrgb color 255 255 0)
(vla-put-colorindex color 2)
(vla-put-TextColor mlstyle color);最下面的这一行改成这样就行了 学习一下 颜色问题我试过0-256,256随层,0随块.其他即为索引颜色 为什呢我的电脑提示错误: no function definition: ADDMLEADERSTYLE cad颜色序号->多重引线样式颜色
我就想知道是不是没有办法通过程序将某个多重引线样式置为当前
页:
[1]
2