fend_2000 发表于 2004-9-7 12:35:00

求助各位:標注

确定一点o为基准点,标注一个圆r的座标尺寸?


<BR>我的程序出现的不行问题是:圆的座标没有标到圆心上,而在距离圆好远的地方,我认为是<BR>我的破旧座标转换的有问题,我搞了许久,还 是不行。请各位赐教。谢谢!

meflying 发表于 2004-9-7 12:49:00

你的程序呢?

fend_2000 发表于 2004-9-7 14:00:00

(defun c:dimc ()<BR>(setvar "cmdecho" 0)<BR>(setvar "dimtih" 0)<BR>(command "osnap" "int,cen,mid")<BR>(setq Po (getpoint "Original Point :"))<BR>(command "ucs" "new" po)<BR>(setq p1 (getpoint "Lower left corner :"))<BR>(setq p2 (getpoint "upper righe corner :"))<BR>(ssget "w" p1 p2)<BR>(setq xx(ssget "x" (list(cons 0 "circle"))))<BR>(setq index 0)<BR>(setq entname(ssname xx index))<BR>(setq entlist(entget entname))<BR>(setq entasso(assoc 10 entlist))<BR>(setq x1(cadr entasso))<BR>(setq y1(caddr entasso))<BR>(setq x11(+ x1 10))<BR>(setq y11(+ y1 10))<BR>(setq xy(list x1 y1))<BR>       (command "dimordinate" xy "ydatum" x11 )<BR>       (command "dimordinate" xy "xdatum" y11 )<BR>(setvar "cmdecho" 1)<BR>(princ)<BR>)       <BR>       <BR>       <BR>       <BR>       <BR>

meflying 发表于 2004-9-7 14:12:00

;(setq p1 (getpoint "Lower left corner :"))<BR>       ;(setq p2 (getpoint "upper righe corner :"))<BR>       ;(ssget "w" p1 p2)


这三句不知道你做什么用的,好象没有什么作用,还有你


(setq xx(ssget "x" (list(cons 0 "circle"))))<BR>(setq index 0)<BR>(setq entname(ssname xx index))


选择了所有的圆,为何只对第一个圆操作,如果这样,你直接选择你需要操作的远不就可以了吗


       (command "dimordinate" xy "ydatum" x11)<BR>       (command "dimordinate" xy "xdatum" y11)


这里x11和y11处需要的参数应该是点,你的x11和y11都不是点,而是一个数,导致错误

fend_2000 发表于 2004-9-7 14:24:00

楼上大哥:我的程序本来是想对多个圆标注,要有一个循环的,由於程序有错我就先改为对一个圆标注,给你传上来了。
<TABLE border=0 class=tablebody2 style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all" width="90%">
<TBODY>
<TR>
<TD style="FONT-SIZE: 9pt; LINE-HEIGHT: 12pt" width="100%"><IMG alt=发贴心情 border=0 src="http://www.mjtd.com/bbs/skins/default/topicface/face1.gif">        <B></B><BR>       ;(setq p1 (getpoint "Lower left corner :"))<BR>       ;(setq p2 (getpoint "upper righe corner :"))<BR>       ;(ssget "w" p1 p2)



这三句不知道你做什么用的,好象没有什么作用,还有你


(setq xx(ssget "x" (list(cons 0 "circle"))))<BR>(setq index 0)<BR>(setq entname(ssname xx index))


选择了所有的圆,为何只对第一个圆操作,如果这样,你直接选择你需要操作的远不就可以了吗


       (command "dimordinate" xy "ydatum" x11)<BR>       (command "dimordinate" xy "xdatum" y11)


这里x11和y11处需要的参数应该是点,你的x11和y11都不是点,而是一个数,导致错误


我改了,但是还是有问题。

</TD></TR></TBODY></TABLE>


  (defun c:dimc ()<BR>(setvar "cmdecho" 0)<BR>(setvar "dimtih" 0)<BR>(command "osnap" "int,cen,mid")<BR>(setq Po (getpoint "Original Point :"))<BR>(command "ucs" "new" po)<BR>(setq p1 (getpoint "Lower left corner :"))<BR>(setq p2 (getpoint "upper righe corner :"))<BR>(ssget "w" p1 p2)<BR>(setq xx(ssget "x" (list(cons 0 "circle"))))<BR>(setq index 0)<BR>(setq entname(ssname xx index))<BR>(setq entlist(entget entname))<BR>(setq entasso(assoc 10 entlist))<BR>(setq x1(cadr entasso))<BR>(setq y1(caddr entasso))<BR>(setq x11(+ x1 5))<BR>(setq y11(+ y1 5))<BR>(setq xx(list x11 y1))<BR>(setq yy(list x1 y11))<BR>       (command "dimordinate" xy "ydatum" xx )<BR>       (command "dimordinate" xy "xdatum" yy )<BR>(setvar "cmdecho" 1)<BR>(princ)<BR>)       <BR>       <BR>       <BR>       <BR>       <BR>

spring 发表于 2004-9-7 14:48:00

你改过的程序还是一样的啊,只对第一个圆处理


这是我以前写的


;;;功能:圆心自动标注<BR>;;;BY        Spring<BR>;;;09/02-03<BR>;;;_______________________________________________________<BR>(defun        AI_ERROR        (errmsg)<BR>                (if        errmsg<BR>                                '("console        break"<BR>                                                "Function        Cancelled"<BR>                                        )<BR>                                (princ        (strcat        "\nError:        "        errmsg))<BR>                )<BR>                (princ)<BR>)<BR>;;;_______________________________________________________<BR>(defun        c:CIRDIM        (/                cm                old_error                *error*        p1<BR>                        ss                count                sscount        en                ed                cen_x<BR>                        cen_y                cen                x                y<BR>                )<BR>                (setvar        "MODEMACRO"        "***SPRING***")<BR>                (setq        cm        (getvar        "cmdecho"))<BR>                (setvar        "cmdecho"        0)<BR>                (command        "_.UNDO"        "Group")<BR>                (setq        old_error        *error*)<BR>                (setq        *error*        AI_ERROR)<BR>                (command        "_.UCS"        "World")<BR>                (setq        p1        (getpoint        "\n        请指定基准点        /        &lt;退出&gt;"))<BR>                (if        p1<BR>                                (progn<BR>                                                (command        "_.UCS"        "O"        P1)<BR>                                                (setq        ss        (ssget        '((0        .        "CIRCLE"))))<BR>                                                (setq        count        0)<BR>                                                (setq        sscount        (sslength        ss))<BR>                                                (while        (&lt;        count        sscount)<BR>        (setq        en        (ssname        ss        count))<BR>        (setq        ed        (entget        en))<BR>        (setq        cen        (cdr        (assoc        10        ed)))<BR>        (setq        cen_x        (-        (car        cen)        (car        p1)))<BR>        (setq        cen_y        (-        (cadr        cen)        (cadr        p1)))<BR>        (setq        cen        (append        (list        cen_x        cen_y)))<BR>        (setq        x        (polar        cen        0        8))<BR>        (setq        y        (polar        cen        (*        pi        1.5)        8))<BR>        (command        "dimordinate"        cen        x)<BR>        (command        "dimordinate"        cen        y)<BR>        (setq        count        (1+        count))<BR>                                                )<BR>                                )<BR>                )<BR>                (command        "_.UCS"        "Prev")<BR>                (command        "_.UNDO"        "End")<BR>                (setvar        "cmdecho"        cm)<BR>                (setq        *error*        old_error)<BR>                (princ)<BR>)



------------------------------------------


可是现在不能自动避位,meflying 可以帮忙完善一下吗?有很多人都需要这种程序的

ding9736 发表于 2004-9-19 18:16:00

我这里有一个不太完善程的式,你看一下吧,是标注在"P"层的圆的圆心坐标的,也希望各位高手修正完善:


****************automatic dimension****************************************************<BR>(defun C:BX (/)                                ;                               bp                       cmde               blip       ss        w                                       n                                       ll<BR>                                        ;e1dxf       e1typ       dxf10       dxf11       dxf40        dxf50       dxf51       an<BR>                                        ;aa                               dp                       cenpt       spt<BR>                                        ;)<BR>       (setq        bp               (getpoint "\nBase point: ")<BR>        cmde (getvar "CMDECHO")<BR>        blip (getvar "BLIPMODE")<BR>        ss               (ssget (list (cons 0 "CIRCLE") (cons 8 "P")))<BR>        w                       (getvar "WORLDUCS")<BR>        n                       0<BR>        LL               (* 0.5 (getvar "DIMSCALE"))<BR>       )<BR>       (setvar "CMDECHO" 1)<BR>       (setvar "BLIPMODE" 0)<BR>       (command "UNDO" "G")<BR>       (command "UCS" "OR" bp)<BR>       (setq bp (list 0.0 0.0))<BR>       (command "DIM1" "ORD" bp "X"<BR>                       (list 0 (* -1 LL))<BR>                       "")<BR>(setq DBSX (SSGET "L"))<BR>(command "DIM1" "ORD" bp "Y"<BR>                       (list (* -1 LL) 0)<BR>                       "" )<BR>(setq DBSY (SSGET "L"))<BR>       (while (&lt; n (sslength ss))<BR>                       (setq e1dxf        (entget (ssname ss n))<BR>               e1typ        (cdr (assoc 0 e1dxf))<BR>               dxf10        (cdr (assoc 10 e1dxf))<BR>                       )<BR>                       (PROGN<BR>                                       (setq dxf40 (cdr (assoc 40 e1dxf))<BR>                               dxf10 (trans dxf10 0 1)<BR>                                       )<BR>                                       (setq dxf10x (car dxf10)<BR>                               dxf10y (cadr dxf10)<BR>                                       )<BR>                                       (autodim1)<BR>                       )<BR>                       (setq n (1+ n)<BR>               dxf11        nil<BR>                       )<BR>       )<BR>       (if (= w 1)<BR>                       (command "UCS" "w")<BR>                       (command "UCS" "P")<BR>       )<BR>       (command "UNDO" "E")<BR>       (setvar "CMDECHO" cmde)<BR>       (setvar "BLIPMODE" blip)<BR>       (princ)<BR>)


(defun autodim1        ()<BR>       (if (&gt; (cadr dxf10) (cadr bp))<BR>                       (command "dimbaseline" DBSX dxf10<BR>                                       (polar dxf10 (* 0.5 pi) LL)<BR>                                       "" ""       )<BR>                                                       (command "DIM1"<BR>                                       "ORD"<BR>                                       dxf10<BR>                                       "x"<BR>                                       (polar dxf10 (* 1.5 pi) LL)<BR>                                       ""<BR>                       )<BR>       )<BR>       (if (&gt; (car dxf10) (car bp))<BR>                       (command "DIM1" "ORD" dxf10 "y" (polar dxf10 0 LL) "")<BR>                       ;(command "DIM1" "ORD" dxf10 "y" (polar dxf10 pi LL) "")<BR>       )<BR>       (if dxf11<BR>                       (progn<BR>                                       (if (&gt; (cadr dxf11) (cadr bp))<BR>        (command "DIM1"<BR>               "ORD"<BR>               dxf11<BR>               "x"<BR>               (polar dxf11 (* 0.5 pi) LL)<BR>               ""<BR>        )<BR>        (command "DIM1"<BR>               "ORD"<BR>               dxf11<BR>               "x"<BR>               (polar dxf11 (* 1.5 pi) LL)<BR>               ""<BR>        )<BR>                                       )<BR>                                       (if (&gt; (car dxf11) (car bp))<BR>        (command "DIM1" "ORD" dxf11 "y" (polar dxf11 0 LL) "")<BR>        ;(command "DIM1" "ORD" dxf11 "y" (polar dxf11 pi LL) "")<BR>                               )<BR>                       )<BR>       )<BR>       (princ)<BR>)


<BR>

xyp1964 发表于 2004-9-19 21:36:00

圆心坐标标注程序,加载yxzb.lsp,运行yxzb

hzh2000 发表于 2004-9-19 22:27:00

把(command "dimordinate" xy "ydatum" x11 )<BR>       (command "dimordinate" xy "xdatum" y11 )<BR>改为(command "dimordinate" "non"        xy "ydatum" x11 )<BR>       (command "dimordinate"                "non"       xy "xdatum" y11 )<BR>
页: [1]
查看完整版本: 求助各位:標注