andy_lee 发表于 2022-7-5 22:32:06

帮助需要绘制此符号

嗨,伙计们
我的英语很差,所以上传图片进行解释。
 
在曲线上绘制圆弧。(直线、直线、圆、圆弧、椭圆)
 
可以指定起点和终点
 
还有一些选择。

 
两种类型
类型1
类型2
 
方向,使用对话框选择
 
如果选择type1,那么可以使用“鼠标手势”来选择曲线的哪一侧。
 
宽度和间距,例如宽度=2,间距=1
 
弧度(%)
也可以固定。这样地:

pBe 发表于 2022-7-5 22:39:32

安迪,
 
从表面上看,这个程序已经被其他人完成了,你的帖子上的pix是从哪里来的?

andy_lee 发表于 2022-7-5 22:46:33

 
尊敬的pBe。
没有见过类似的应用。我使用ODCL和PS绘制该对话框。

pBe 发表于 2022-7-5 22:50:09

 
你让我在那里,安迪,聪明。
 
也许过会儿我会去看看

andy_lee 发表于 2022-7-5 22:53:19

 
哈哈。别开玩笑了。
如果有人能帮忙。我会很高兴的。

hanhphuc 发表于 2022-7-5 22:59:05

如果我们用圆弧手工制作一个块
然后
命令:测量

命令:分割
对的
你能澄清弧度百分比吗?

andy_lee 发表于 2022-7-5 23:05:49

 
谢谢你的回复,我的朋友韩。
 
弧度这并不重要。可以这样替换:
 
为什么需要制作积木?我认为可以使用
entmake创建。

hanhphuc 发表于 2022-7-5 23:09:16

 
您误解了,如果使用命令手动(不编码)测量(带块),
是的,entmake是在多段线对齐中操作的编码的一部分

pBe 发表于 2022-7-5 23:14:56

 
这可能会奏效,也许可以使用动态块

andy_lee 发表于 2022-7-5 23:20:12

嗨,我的朋友韩。
可能参考此例程
http://bbs.mjtd.com/thread-101300-1-1.html
(defun C:SM (/ A AN AN0 BASEPT BETWEEN BOOL CURVEBLOCK CURVELENGTH DISTANC EN FIRSTPOINT LASTB LASTBLIST LASTBLOCK N PP PT PT0 SSADD1 STRIN TRIN VT)


(defun *error* (msg)
    (vl-bt)
    (if        *DOC*
      (_EndUndo *DOC*)                       
    )
    (while (not (equal (getvar "cmdnames") "")) (command nil))
    (princ "\n Error!")
    (princ)
)

(defun stratpointT (en pt0 / CURVELENGTH L1)
    (setq CurveLength
           (vlax-curve-getDistAtParam
           en
           (vlax-curve-getEndParam en)
           )
    )
    (setq L1 (vlax-curve-getDistAtPoint en pt0))
    (< L1 (- CurveLength L1))
)

(defun NAME_BLK (CurveLength / A Y)
    (setq A (rtos (* (getvar "CDATE") 1E8)))
    (setq Y (/ CurveLength 5.0))
    (entmake (list '(0 . "LINE")
                   (cons 10 (list 0 0 0))
                   (cons 11 (list 0 y 0))
           )
    )
    (command "_.BLOCK"
           A
           "non"
           (list 0 (/ y 2.0) 0)
           (entlast)
           ""
    )
    A
)

(defun MyAttAdd (en n / ELIST N1 N3 NEND QIANZ STREND TEXT)
    (setq elist (entget (entnext en)))
    (setq text (cdr (assoc 1 elist)))
    (setq n3 (strlen text))                       
    (setq strEND (getNumberS text))               
    (setq Nend (nth (1- (length strEND)) strEND))
    (setq n1 (strlen Nend))                       
    (setq qianZ (substr text 1 (- n3 n1)))       
    (setq strEND (+ (atof (car strEND)) n))       
    (setq strEND (strcat qianZ (rtos strEND 2 3)))
    (entmod (subst (cons 1 strEND) (assoc 1 elist) elist))
    (entupd en)
   
)

(defun MyTextAdd (en n / ELIST N1 N3 NEND QIANZ STREND TEXT)
    (setq elist (entget en))
    (setq text (cdr (assoc 1 elist)))
    (setq n3 (strlen text))                       
    (setq strEND (getNumberS text))               
    (setq Nend (nth (1- (length strEND)) strEND))
    (setq n1 (strlen Nend))                       
    (setq qianZ (substr text 1 (- n3 n1)))       
    (setq strEND (+ (atof (car strEND)) n))       
    (setq strEND (strcat qianZ (rtos strEND 2 3)))
    (entmod (subst (cons 1 strEND) (assoc 1 elist) elist))
)

(vl-load-com)
(or *DOC*
      (setq *DOC* (vla-get-ActiveDocument (vlax-get-acad-object)))
)
(_StartUndo *DOC*)
(setvar "nomutt" 1)
(princ "\n >Select the curve")
(while (not
           (and        (setq en (ssget ":E:S" '((0 . "*LINE,ARC,ELLIPSE"))))
                (setq en (ssname en 0))
           )
        )
    (princ "\n >Re select the curve")
)
(setvar "nomutt" 0)
(setq pt0 (vlax-curve-getClosestPointTo en (cadr (grread T )))

(setq        CurveLength
        (vlax-curve-getDistAtParam
           en
           (vlax-curve-getEndParam en)
        )
)

(setq        curveBlock
        (car (ENTSEL "\n ..>>Select the arrangement of objects along:"))
)
(if curveBlock
    nil
    (progn (setq A (NAME_BLK CurveLength))
           (command "_.INSERT" A "@" "" "" "")
           (setq lastblock (entlast))
           (setq curveBlock lastblock)
    )
)
(setq an0 (entget curveBlock))       
(setq basePt (cdr (assoc 10 an0)))
(setq an0 (cdr (assoc 50 an0)))       

(setq bool T)
(setq        strin (strcat "\n ...>>>The length of the curve"
                      (rtos CurveLength 2 3)
                      ",Enter the spacing: "
              )
)
(while bool
    (initget 7)
    (setq between (getreal strin))
    (if        (> between CurveLength)
      (progn (setq bool T) (alert "Object spacing must be smaller than the curve length!!!"))
      (setq bool nil)
    )
)
(initget 4)
(setq strin (rtos (/ (rem CurveLength between) 2.0) 2 3))
(setq
    distanc (getreal
              (strcat "\n ....>>>>The spacing of first object & Curve endpoint<" strin ">:")
            )
)
(if distanc
    nil
    (setq distanc (/ (rem CurveLength between) 2.0))
)

(setq n (fix (/ (- CurveLength distanc) between)))
(if (stratpointT en pt0)
    (setq firstPoint distanc)
    (setq firstPoint (rem (- CurveLength distanc) between))
)
(setq ssadd1 (ssadd))

(repeat (setq n (1+ n))
    (setq pt (vlax-curve-getPointAtDist en firstPoint)
        pp (vlax-curve-getParamAtPoint en Pt)       
        vt (vlax-curve-getFirstDeriv en pp)       
        an (angle '(0 0 0) vt)               
    )
    (command "._copy" curveBlock "" "non" basePt "non" PT)
    (setq LastB (entlast))
    (setq LastBList (entget LastB))

    (cond ((assoc 66 LastBList) (MyAttAdd LastB (setq n (1- n))))
        ((equal (cdr (assoc 0 LastBList)) "TEXT")
           (MyTextAdd LastB (setq n (1- n)))
        )
    )

    ;;(entmod (subst (cons 50 an) (assoc 50 LastBList) LastBList))
    (command "_.rotate" LastB "" "non" pt (/ (* 180 (- an an0)) pi))
    (setq ssadd1 (ssadd LastB ssadd1))
    (setq firstPoint (+ firstPoint between))
)
(if lastblock
    (command "._erase" lastblock "")
    (progn (initget "R")
           (setq trin
                (getstring "\nTo block rotated 180 degrees, input R<Enter>")
           )
           (if (or (equal trin "R") (equal trin "r"))
           (repeat (setq n (sslength ssadd1))
               (setq LastB (ssname ssadd1 (setq n (1- n))))
               (setq LastBList (entget LastB))
               (setq an (cdr (assoc 50 LastBList)))
               (setq an (+ an pi))
               (entmod (subst (cons 50 an) (assoc 50 LastBList) LastBList))
           )
           )
    )
)
(_EndUndo *DOC*)
(princ)
)



(defun _StartUndo (*DOC*)
(_EndUndo *DOC*)
(vla-StartUndoMark *DOC*)
)

(defun _EndUndo        (*DOC*)
(if (= 8 (logand 8 (getvar 'UNDOCTL)))
    (vla-EndUndoMark *DOC*)
)
)
页: [1] 2
查看完整版本: 帮助需要绘制此符号