[求助]关于采用lisp修改标注样式的问题
本帖最后由 作者 于 2009-4-16 21:49:55 编辑 <br /><br /> <p>本人想通过lisp程序修改标注样式的尺寸线、界线和文字的颜色为随层,代码如下:</p><p> (setq dimen2 (tblobjname "dimstyle" “标注样式名称”)) ;使标注样式以对象符号存在<br/> (setq dimen2_data (entget dimen2)) ;取得对象列表<br/> (if (assoc 178 dimen2_data) ;替换文字颜色<br/> (setq dimen2_data (subst (cons 178 256) (assoc 178 dimen2_data) dimen2_data))<br/> (setq dimen2_data (reverse (cons (cons 178 256) (reverse dimen2_data)))) <br/> )<br/> (if (assoc 176 dimen2_data) ;替换尺寸线颜色<br/> (setq dimen2_data (subst (cons 176 256) (assoc 176 dimen2_data) dimen2_data))<br/> (setq dimen2_data (reverse (cons (cons 176 256) (reverse dimen2_data)))) <br/> )<br/> (if (assoc 177 dimen2_data) ;替换尺寸界线颜色<br/> (setq dimen2_data (subst (cons 177 256) (assoc 177 dimen2_data) dimen2_data))<br/> (setq dimen2_data (reverse (cons (cons 177 256) (reverse dimen2_data)))) <br/> )<br/> (entmod dimen2_data)</p><p>现出现两个问题:1.标注样式内出现了替代样式;2.标注样式内设置的颜色已改对,但是图中以前用这个样式做的尺寸标注的颜色都没有变。</p><p>小弟刚学alisp不久,请高手帮忙改下。谢谢!</p> <p>版版帮忙解答一下吧,谢谢!</p> Sub adAddDimStyle()Dim a As AcadDimStyle
Dim b As AcadDimStyle
Dim c As AcadDimStyle
Dim d As AcadDimStyle
Dim e As AcadDimStyle
Dim f As AcadDimStyle
Set a = ThisDrawing.DimStyles.Add("1")
Set b = ThisDrawing.DimStyles.Add("DIMSTYLE_2")
Set c = ThisDrawing.DimStyles.Add("DIMSTYLE_3")
Set d = ThisDrawing.DimStyles.Add("DIMSTYLE_4")
Set e = ThisDrawing.DimStyles.Add("DIMSTYLE_5")
Set f = ThisDrawing.DimStyles.Add("DIMSTYLE_6")
ThisDrawing.ActiveDimStyle = a
With ThisDrawing
'The first group defines overall and linear scale factors
.SetVariable "Dimtxt", 96 'Overall Scale Factor. Determined by 12/Scale Factor.
.ActiveDimStyle.CopyFrom .ModelSpace
End With
ThisDrawing.ActiveDimStyle = a
With ThisDrawing
'The first group defines overall and linear scale factors
.SetVariable "Dimtxt", 22 'Overall Scale Factor. Determined by 12/Scale Factor.
Call b.CopyFrom(ThisDrawing.ModelSpace)
End With
ThisDrawing.ActiveDimStyle = a
With ThisDrawing
'The first group defines overall and linear scale factors
.SetVariable "Dimtxt", 44 'Overall Scale Factor. Determined by 12/Scale Factor.
Call c.CopyFrom(ThisDrawing.ModelSpace)
End With
ThisDrawing.ActiveDimStyle = d
With ThisDrawing
'The first group defines overall and linear scale factors
.SetVariable "Dimtxt", 99 'Overall Scale Factor. Determined by 12/Scale Factor.
Call d.CopyFrom(ThisDrawing.ModelSpace)
End With
ThisDrawing.ActiveDimStyle = e
With ThisDrawing
'The first group defines overall and linear scale factors
.SetVariable "Dimtxt", 122 'Overall Scale Factor. Determined by 12/Scale Factor.
Call e.CopyFrom(ThisDrawing.ModelSpace)
End With
ThisDrawing.ActiveDimStyle = f
With ThisDrawing
'The first group defines overall and linear scale factors
.SetVariable "Dimtxt", 1122 'Overall Scale Factor. Determined by 12/Scale Factor.
Call f.CopyFrom(ThisDrawing.ModelSpace)
End With
ThisDrawing.ActiveDimStyle = a
End Sub
呵呵,想到了
command "-dimstyle" "要改动的样式名称" "dimtxt" 文字高度 "-dimstyle" "s" "要改动的样式名称" "Y"
"dimclrd" "4" ;尺寸线、箭头和标注引线指定颜色。
"dimltype" "byblock" ;线型
"dimlwd" "-2" ;线宽
"dimdle" "0.6" ;超出标记,当使用小斜线代替箭头进行标注时
"dimdli" "0" ;基线间距,
"dimsd1" "0" ;隐藏尺寸线1,0显示,1隐藏
"dimsd2" "0" ;隐藏尺寸线2,0显示,1隐藏
;延伸线
"dimclre" "4" ;颜色
"dimltex1" "byblock" ;延伸线1的线型
"dimltex2" "byblock" ;延伸线2的线型
"dimlwe" "-2" ;线宽
"dimse1" "0" ;隐藏延伸线1,0显示,1隐藏
"dimse2" "0" ;隐藏延伸线2,0显示,1隐藏
"dimexe" "1" ;超出尺寸线的长度
"dimexo" "1" ;七点偏移量的长度
"dimfxlon" "0" ;固定长度的延伸线,关闭。
;符号和箭头
"dimblk1" "_ArchTick" ;第一个箭头样式,建筑标记
"dimblk2" "_ArchTick" ;第二个箭头样式,建筑标记
"dimldrblk" "_OPEN90" ;引线的箭头样式
"dimasz" "0.5" ;箭头大小
;圆心标记
"dimcen" "2.0" ;圆心标注方式为”标记“ 大小为2,0为无,直线为负数
;弧长符号
"dimarcsym" "1" ;三种样式分别为:0标注文字的前缀,1标注文字的上方,2无
;半径折弯标注
"dimjogang" "45" ;折弯角度
"dimlfac" "1" ;设置线性标注测量值的比例因子
;文字
"dimtxsty" "HZ" ;文字样式
"dimclrt" "3" ;文字颜色
"dimtfill" "0" ;不填充
"dimtxt" "2.5" ;文字高度
"dimtad" "1" ;垂直位置,0居中,1上方,2外部,3日本标准,4下方
"dimjust" "0" ;水平位置,0居中
"dimtxtdirection" "0" ;观察方向,0从左到右
"DIMGAP" "1" ;从尺寸线偏移
"dimtoh" "0" ;文字对齐样式,0与尺寸线对齐,1水平或ISO标准
;调整
"dimtix" "1" ;文字使用保持在尺寸界线之间
"dimsoxd" "0" ;若箭头。。。关闭
"dimtmove" "2" ;文字位置,尺寸线上方
"dimscale" (setq fmtval (rtos xcv 2 0)) ;全局比例
"dimupt" "0" ;手动放置位置位置,关闭
"dimtofl" "1" ;在延伸线之间绘制尺寸线,开启
;主单位
"dimdec" "0" ;精度
"dimdsep" "." ;小数分隔符
"dimrnd" "0.00000" ;舍入
"dimlfac" "1.00000" ;测量单位比例
"dimzin" "1" ;控制对主单位值的消零处理
;角度标注
"dimaunit" "0" ;角度标注的单位格式
"dimadec" "2" ;角度的精度
"dimazin" "2" ;角度后续消零
;换算单位
"dimalt" "0" ;关闭换算单位
;公差
"dimtol" "0" ;关闭换算单位
页:
[1]