本帖最后由 kozmosovia 于 2016-1-19 16:35 编辑
136724140 发表于 2016-1-19 16:03 
应该是文字的插入点坐标, 规范来说,文字的插入点应该与圆的圆心相同位置的
文字对齐方式有多种,所以文字的插入点坐标是要统一的?
从截图看,圆已经存在了。而且有些没有和文字插入点叠合。
建议先删除或者隔离已有的半径为1的圆,然后运行程序。程序会自动在文字插入点生成半径为1的新圆。
- (Defun C:ABC (/ IDX II INS MS RNG RRR SS TXT VLO XL)
- (if (setq idx 0
- ms (vla-get-Modelspace
- (vla-get-activeDocument (vlax-get-acad-object))
- )
- xl (vlax-get-object "excel.application")
- )
- (while (and (setq rng (vlax-get-property
- xl
- "Range"
- (strcat "A" (itoa (setq idx (1+ idx))))
- )
- txt (vlax-variant-value (vlax-get-property rng "Text"))
- )
- (/= txt "")
- )
- (if (setq ii -1
- ss (ssget "_x" (list (cons 0 "*text") (cons 1 txt)))
- )
- (repeat (sslength ss)
- (setq
- vlo (vlax-ename->vla-object (ssname ss (setq ii (1+ ii))))
- ins (vla-get-insertionpoint vlo)
- rrr (vlax-get-property
- xl
- "Range"
- (strcat "B" (itoa idx) ":D" (itoa idx))
- )
- )
- (vlax-put-property rrr "Value2" ins)
- (vla-addcircle ms ins 1.0)
- )
- )
- )
- )
- (if xl
- (vlax-release-object xl)
- )
- (princ)
- )
|