...书写堆叠样式的公差函数 上偏差为+0.02 下偏差为0,注意0前面不要...
发布网友
发布时间:2024-10-02 15:43
我来回答
共1个回答
热心网友
时间:2024-11-22 09:48
试用以下程序,看能否达到所要求的效果。
;标注文字写入公差
;dnbc1
(defun c:ccc()
(vl-load-com)
(setq cm (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_undo" "be")
(while (setq ssa (ssget ":S" '((0 . "DIMENSION"))))
(if (setq zmax (getstring "\n上偏差:"))
(if (setq zmin (getstring "\n下偏差:"))
(progn
(setq ent (ssname ssa 0)
obj (vlax-ename->vla-object ent)
name (vlax-get obj "ObjectName")
valu (vlax-get obj "Measurement")
)
(if (wcmatch name "AcDb2LineAngularDimension,AcDb3PointAngularDimension")
(setq xsws (vlax-get obj "TextPrecision")
Prefix ""
Suffix "°"
valu (/ (* valu 180.0) pi)
)
(setq xsws (vlax-get obj "PrimaryUnitsPrecision")
Prefix (nth (vl-position name '("AcDbAlignedDimension"
"AcDbRotatedDimension"
"AcDbRadialDimension"
"AcDbDiametricDimension"
"AcDb2LineAngularDimension"
"AcDb3PointAngularDimension"
)
)
'("" "" "R" "φ" "" "")
)
Suffix ""
)
)
(vlax-put obj "TextOverride" (strcat Prefix (rtos valu 2 xsws) Suffix "\\H0.75x;\\S" zmax "^" zmin))
(vla-update obj)
)
)
)
)
(command "_undo" "e")
(setvar "cmdecho" cm)
(princ)
)