明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3537|回复: 15

[提问] 【矩阵运算】从布局空间复制图元至到模型空间

[复制链接]
发表于 2015-8-14 16:14:34 | 显示全部楼层 |阅读模式
本帖最后由 smartstar 于 2015-8-19 09:06 编辑


图片演示的是LEE MAC的“Modelspace to Paperspace”功能(附件是LEE MAC的程序文件),我想把此功能逆向操作,就拿LEE MAC的程序进行了修改,但用于水平有限,lisp矩阵运算一头雾水,所以只完成了一个半成品。只有当视口没有旋转的时候能够正常运行,当视口旋转了,拷贝到模型空间的图元就不在想要的位置上了,贴出来让高手们帮忙修改一下。代码如下:
  1. (defun c:ps2ms ( / *error* ang doc enx idx lst mat nor scl sel )
  2.         (vl-load-com)
  3.         (defun *error* ( msg )
  4.                 (LM:endundo (LM:acdoc))
  5.                 (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
  6.                         (princ (strcat "\nError: " msg))
  7.                 )
  8.                 (princ)
  9.         )
  10.        
  11.         (LM:startundo (LM:acdoc))
  12.         (cond
  13.                 (   (= 1 (getvar 'tilemode))
  14.                         (prompt "\nCommand only available in Paperspace.")
  15.                 )
  16.                 (   (= 1 (getvar 'cvport))
  17.                         (prompt "\nPlease activate a viewport.")
  18.                 )
  19.                 (   (setq enx (entget (ssname (ssget "_X" (list '(0 . "VIEWPORT") (cons 69 (getvar 'cvport)))) 0)))
  20.                         (command "PSPACE")
  21.                         (setq sel (ssget (list (cons 410 (getvar 'ctab)))))
  22.                         (repeat (setq idx (sslength sel))
  23.                                 (setq lst (cons (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))) lst));图元名称表
  24.                         )
  25.                        
  26.                        
  27.                         (setq ang (- (cdr (assoc 51 enx))));视图扭转角度
  28.                         (setq nor (cdr (assoc 16 enx)));16观察方向矢量(在WCS中)17观察目标点(在WCS中)10 中心点(在WCS中) 12视口中心(在DCS中)
  29.                         (setq scl (/ (cdr (assoc 45 enx)) (cdr (assoc 41 enx)))) ;ZOOM XP 比例
  30.                         (setq pt (cdr (assoc 10 enx)))
  31.                         (setq mat
  32.                                 (vlax-tmatrix
  33.                                         (append
  34.                                                 (mapcar '(lambda ( a b ) (append a (list b)))
  35.                                                         (setq mat
  36.                                                                 (mxm
  37.                                                                         (mapcar (function (lambda ( v ) (vxs (trans v nor 0 t) scl)))
  38.                                                                                 '(
  39.                                                                                         (1.0 0.0 0.0)
  40.                                                                                         (0.0 1.0 0.0)
  41.                                                                                         (0.0 0.0 1.0)
  42.                                                                                 )
  43.                                                                         )
  44.                                                                         (list
  45.                                                                                 (list (cos ang) (- (sin ang)) 0.0)
  46.                                                                                 (list (sin ang)    (cos ang)  0.0)
  47.                                                                                 '(0.0 0.0 1.0)
  48.                                                                         )
  49.                                                                        
  50.                                                                 )
  51.                                                         )
  52.                                                         (mapcar '+;视口不旋转没有问题
  53.                                                                 (mxv mat (mapcar '- (cdr (assoc 10 enx))))
  54.                                                                 (cdr (assoc 12 enx))
  55.                                                                 ;(vxs (cdr (assoc 17 enx)) (- scl))
  56.                                                                 ;(vxs (cdr (assoc 17 enx))  scl)
  57.                                                                 (cdr (assoc 17 enx))
  58.                                                         )
  59.                                                 )
  60.                                                 '((0.0 0.0 0.0 1.0))
  61.                                         )
  62.                                 )
  63.                         )
  64.                         (foreach obj
  65.                                 (vlax-invoke (setq doc (vla-get-activedocument (vlax-get-acad-object))) 'copyobjects lst
  66.                                         (vla-get-block
  67.                                                 (vla-item
  68.                                                         (vla-get-layouts doc)
  69.                                                         "Model"
  70.                                                 )
  71.                                         )
  72.                                 )
  73.                                 (vla-transformby obj mat)
  74.                         )
  75.                 )
  76.         )
  77.         (LM:endundo (LM:acdoc))
  78.         (princ)
  79. )

  80. ;; Matrix Transpose  -  Doug Wilson
  81. ;; Args: m - nxn matrix
  82. ;;矩阵转置
  83. (defun trp ( m )
  84.         (apply 'mapcar (cons 'list m))
  85. )

  86. ;; Matrix x Matrix  -  Vladimir Nesterovsky
  87. ;; Args: m,n - nxn matrices
  88. ;;矩阵 × 矩阵
  89. (defun mxm ( m n )
  90.         ((lambda ( a ) (mapcar '(lambda ( r ) (mxv a r)) m)) (trp n))
  91. )

  92. ;; Matrix x Vector  -  Vladimir Nesterovsky
  93. ;; Args: m - nxn matrix, v - vector in R^n
  94. ;;矩阵 × 向量
  95. (defun mxv ( m v )
  96.         (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
  97. )

  98. ;; Vector x Scalar  -  Lee Mac
  99. ;; Args: v - vector in R^n, s - real scalar
  100. ;;向量 ×比例
  101. (defun vxs ( v s )
  102.         (mapcar '(lambda ( n ) (* n s)) v)
  103. )

  104. ;; Start Undo  -  Lee Mac
  105. ;; Opens an Undo Group.
  106. (defun LM:startundo ( doc )
  107.         (LM:endundo doc)
  108.         (vla-startundomark doc)
  109. )

  110. ;; End Undo  -  Lee Mac
  111. ;; Closes an Undo Group.
  112. (defun LM:endundo ( doc )
  113.         (while (= 8 (logand 8 (getvar 'undoctl)))
  114.                 (vla-endundomark doc)
  115.         )
  116. )

  117. ;; Active Document  -  Lee Mac
  118. ;; Returns the VLA Active Document Object
  119. (defun LM:acdoc nil
  120.         (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
  121.         (LM:acdoc)
  122. )

  123. ;;----------------------------------------------------------------------;;
以下是我找的一下资料:

  1. ;; WCS2PCS (gile)
  2. ;; Translates a point WCS coordinates to the PaperSpace CS according to
  3. ;; the specified Viewport
  4. ;;
  5. ;; (WCS2PCS pt vp) is the same as (trans (trans pt 0 2) 2 3) when vp is active
  6. ;;
  7. ;; Arguments
  8. ;; pt : a point
  9. ;; vp : the viewport (ename or vla-object)

  10. (defun WCS2PCS (pt vp / elst ang nor scl mat)
  11.   (vl-load-com)
  12.   (and (= (type vp) 'VLA-OBJECT)
  13.        (setq vp (vlax-vla-object->ename vp))
  14.   )
  15.   (setq pt   (trans pt 0 0)
  16.         elst (entget vp)
  17.         ang  (cdr (assoc 51 elst))
  18.         nor  (cdr (assoc 16 elst))
  19.         scl  (/ (cdr (assoc 41 elst)) (cdr (assoc 45 elst)))
  20.         mat  (mxm
  21.                (list (list (cos ang) (- (sin ang)) 0.0)
  22.                      (list (sin ang) (cos ang) 0.0)
  23.                      '(0.0 0.0 1.0)
  24.                )
  25.                (mapcar (function (lambda (v) (trans v nor 0 T)))
  26.                        '((1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0))
  27.                )
  28.              )
  29.   )
  30.   (mapcar '+
  31.           (vxs (mxv mat (mapcar '- pt (cdr (assoc 17 elst)))) scl)
  32.           (vxs (cdr (assoc 12 elst)) (- scl))
  33.           (cdr (assoc 10 elst))
  34.   )
  35. )

  36. ;; PCS2WCS (gile)
  37. ;; Translates a point PaperSpace coordinates to WCS coordinates
  38. ;; according to the specified viewport
  39. ;;
  40. ;; (PCS2WCS pt vp) is the same as (trans (trans pt 3 2) 2 0) when vp is active
  41. ;;
  42. ;; Arguments
  43. ;; pt : a point
  44. ;; vp : the viewport (ename or vla-object)

  45. (defun PCS2WCS (pt vp / ang nor scl mat)
  46.   (vl-load-com)
  47.   (and (= (type vp) 'VLA-OBJECT)
  48.        (setq vp (vlax-vla-object->ename vp))
  49.   )
  50.   (setq pt   (trans pt 0 0)
  51.         elst (entget vp)
  52.         ang  (- (cdr (assoc 51 elst)))
  53.         nor  (cdr (assoc 16 elst))
  54.         scl  (/ (cdr (assoc 45 elst)) (cdr (assoc 41 elst)))
  55.         mat  (mxm
  56.                (mapcar (function (lambda (v) (trans v 0 nor T)))
  57.                        '((1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0))
  58.                )
  59.                (list (list (cos ang) (- (sin ang)) 0.0)
  60.                      (list (sin ang) (cos ang) 0.0)
  61.                      '(0.0 0.0 1.0)
  62.                )
  63.              )
  64.   )
  65.   (mapcar '+
  66.           (mxv mat
  67.                (mapcar '+
  68.                        (vxs pt scl)
  69.                        (vxs (cdr (assoc 10 elst)) (- scl))
  70.                        (cdr (assoc 12 elst))
  71.                )
  72.           )
  73.           (cdr (assoc 17 elst))
  74.   )
  75. )

  76. ;; VXS Multiply a vector by a scalar
  77. ;;
  78. ;; Arguments : a vector and a real

  79. (defun vxs (v s) (mapcar (function (lambda (x) (* x s))) v))

  80. ;; VXV (gile)
  81. ;; Returns the dot product of two vectors (real)
  82. ;;
  83. ;; Arguments : two vectors
  84. ;; return : a real number

  85. (defun vxv (v1 v2) (apply '+ (mapcar '* v1 v2)))

  86. ;; TRP
  87. ;; transposes a matrix -Doug Wilson-
  88. ;;
  89. ;; Argument : a matrix
  90. ;; return : a matrix

  91. (defun trp (m) (apply 'mapcar (cons 'list m)))

  92. ;; MXV
  93. ;; Applies a transformation matrix to a vector  -Vladimir Nesterovsky-
  94. ;;
  95. ;; Arguments : une matrice et un vecteur
  96. ;; return : a vector

  97. (defun mxv (m v)
  98.   (mapcar '(lambda (r) (vxv r v)) m)
  99. )

  100. ;; MXM
  101. ;; Multiplies (combinates) two matrices -Vladimir Nesterovsky-
  102. ;;
  103. ;; Arguments : deux matrices
  104. ;; return : a matrix

  105. (defun mxm (m q)
  106.   (mapcar '(lambda (r) (mxv (trp q) r)) m)
  107. )

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2015-8-14 16:20:15 | 显示全部楼层
ET不是自带这个功能?
 楼主| 发表于 2015-8-14 16:24:55 | 显示全部楼层
edata 发表于 2015-8-14 16:20
ET不是自带这个功能?

没有装ET
发表于 2015-8-14 16:33:18 | 显示全部楼层
你试试这个
  1. (princ "\n \n \ninitializing: ")
  2. (defun c:c2p ()
  3.   (to-paperspace 1)
  4. )
  5. (defun c:m2p ()
  6.   (to-paperspace 0)
  7. )
  8. (defun to-paperspace (qj / q@ qq ql q& q1 q# q0 q$ qo q| q% q?J qjj q@j qqj
  9.                          qlj q&j q1j q#j q0j q$j qoj
  10.                      )
  11.   (setq q@ nil
  12.         qq nil
  13.         q& nil
  14.         q1 nil
  15.         q# nil
  16.         q0 nil
  17.         q$ nil
  18.         qo nil
  19.         q| nil
  20.         q% nil
  21.         q?J nil
  22.         qjj nil
  23.         q@j nil
  24.         qqj nil
  25.         qlj nil
  26.         q&j nil
  27.         q1j nil
  28.         q#j nil
  29.         q0j nil
  30.         q$j nil
  31.         qoj nil
  32.   )
  33.   (setq ql (getvar "cmdecho")
  34.         q@ (getvar "expert")
  35.         qq (getvar "osmode")
  36.         q& (getvar "cvport")
  37.   )
  38.   (setvar "cmdecho" 0)
  39.   (setvar "expert" 2)
  40.   (setvar "osmode" 0)
  41.   (command "undo" "m")
  42.   (defun dtr (q|j)
  43.     (/ (* q|j pi) 180.0)
  44.   )
  45.   (defun rtd (q%j)
  46.     (/ (* q%j 180.0) pi)
  47.   )  
  48.     (if (= (getvar "tilemode") 1)
  49.       (princ "\n \n \n** 该命令不能在模型空间运行,请切换到图纸空间(布局) **")
  50.       (if (= (length (vports)) 1)
  51.         (princ "\n \n \n \n当前没有活动的视口.")
  52.         (progn          
  53.           (setq q?@ *error*)
  54.           (defun *error* (qj@)
  55.             (cond
  56.               ((or
  57.                  (= qj@ "程序取消")
  58.                  (= qj@ "控制台中断")
  59.                )
  60.               )
  61.             )
  62.             (sp2sp_reset)
  63.           )
  64.           (command "mspace")
  65.           (if (= qj 1)
  66.             (princ "\n \n选择需要复制(copy)到图纸空间的对象: \n ")
  67.             (princ "\n \n选择需要移动(move)到图纸空间的对象: \n ")
  68.           )
  69.           (setq q# (ssget))
  70.           (command "pspace")
  71.           (setq q@@ (getvar "ucsname"))
  72.           (command "ucs" "world")
  73.           (setq q$ (ssget "x" (list (cons 0 "viewport"))))
  74.           (if (/= q# nil)
  75.             (progn
  76.               (if (= qj 1)
  77.                 (princ "\n \n正在复制. \n \n请等待...")
  78.                 (princ "\n \n正在移动. \n \n请等待...")
  79.               )
  80.               (while (= q1 nil)
  81.                 (setq qo (ssname q$ 0))
  82.                 (setq q| (entget qo (quote ("acad"))))
  83.                 (setq q% (cadr (assoc (quote -3) q|)))
  84.                 (setq qjj (rtos (/ (cdr (assoc (quote 41) q|)) (cdr
  85.                                                                     (nth 7
  86.                                                                          q%
  87.                                                                     )
  88.                                                                )
  89.                                 ) 2 6
  90.                           )
  91.                 )
  92.                 (if (= (cdr (assoc (quote 68) q|)) 2)
  93.                   (setq q1 1)
  94.                 )
  95.                 (ssdel qo q$)
  96.               )
  97.               (setq qqj (cdr (assoc (quote 10) q|)))
  98.               (command "mspace")
  99.               (setq qq@ (getvar "ucsname"))
  100.               (command "ucs" "view")
  101.               (setq q0 (getvar "viewctr"))
  102.               (setvar "highlight" 0)
  103.               (if (= qj 1)
  104.                 (command "block" "to-paperspace" q0 q# "" "oops")
  105.                 (command "block" "to-paperspace" q0 q# "")
  106.               )
  107.               (if (= qq@ "")
  108.                 (command "ucs" "world")
  109.                 (command "ucs" "r" qq@)
  110.               )
  111.               (command "pspace")
  112.               (command "insert" "*to-paperspace" qqj qjj "0")
  113.               (if (= q@@ "")
  114.                 (command "ucs" "world")
  115.                 (command "ucs" "r" q@@)
  116.               )
  117.               (princ "\n \n \n ")             
  118.               (princ "\n \n \n完成... ")
  119.             )
  120.             (progn
  121.               (princ "\n \n \n")
  122.               (alert "你没有选择对象!")
  123.             )
  124.           )
  125.           (if (= q& 1)
  126.             (command "pspace")
  127.             (command "mspace")
  128.           )
  129.         )
  130.       )
  131.     )
  132.   
  133.   (setvar "expert" q@)
  134.   (setvar "cmdecho" ql)
  135.   (setvar "osmode" qq)
  136.   (setvar "highlight" 1)
  137.   (setq q@ nil
  138.         qq nil
  139.         q& nil
  140.         q1 nil
  141.         q# nil
  142.         q0 nil
  143.         q$ nil
  144.         qo nil
  145.         q| nil
  146.         q% nil
  147.         q?J nil
  148.         qjj nil
  149.         q@j nil
  150.         qqj nil
  151.         qlj nil
  152.         q&j nil
  153.         q1j nil
  154.         q#j nil
  155.         q0j nil
  156.         q$j nil
  157.         qoj nil
  158.   )
  159.   (princ)
  160. )
  161. (defun c:c2m ()
  162.   (to-modelspace 1)
  163. )
  164. (defun c:m2m ()
  165.   (to-modelspace 0)
  166. )
  167. (defun to-modelspace (qj / q@ qq ql q& q1 q# q0 q$ qo q| q% q?J qjj q@j qqj
  168.                          qlj q&j q1j q#j q0j q$j qoj
  169.                      )
  170.   (setq q@ nil
  171.         qq nil
  172.         q& nil
  173.         q1 nil
  174.         q# nil
  175.         q0 nil
  176.         q$ nil
  177.         qo nil
  178.         q| nil
  179.         q% nil
  180.         q?J nil
  181.         qjj nil
  182.         q@j nil
  183.         qqj nil
  184.         qlj nil
  185.         q&j nil
  186.         q1j nil
  187.         q#j nil
  188.         q0j nil
  189.         q$j nil
  190.         qoj nil
  191.   )
  192.   (setq ql (getvar "cmdecho")
  193.         q@ (getvar "expert")
  194.         qq (getvar "osmode")
  195.         q& (getvar "cvport")
  196.   )
  197.   (setvar "cmdecho" 0)
  198.   (setvar "expert" 2)
  199.   (setvar "osmode" 0)
  200.   (command "undo" "m")
  201.   (defun dtr (q|j)
  202.     (/ (* q|j pi) 180.0)
  203.   )
  204.   (defun rtd (q%j)
  205.     (/ (* q%j 180.0) pi)
  206.   )   
  207.     (if (= (getvar "tilemode") 1)
  208.       (princ "\n \n \n** 该命令不能在模型空间运行,请切换到图纸空间(布局) **")
  209.       (if (= (length (vports)) 1)
  210.         (princ "\n \n \n \n当前没有活动的视口.")
  211.         (progn          
  212.           (setq q?@ *error*)
  213.           (defun *error* (qj@)
  214.             (cond
  215.               ((or
  216.                  (= qj@ "程序取消")
  217.                  (= qj@ "控制台中断")
  218.                )
  219.               )
  220.             )
  221.             (sp2sp_reset)
  222.           )
  223.           (command "pspace")
  224.           (if (= qj 1)
  225.             (princ "\n \n选择需要复制(Copy)到模型空间(视口)的对象: \n ")
  226.             (princ "\n \n选择需要移动(Move)到模型空间(视口)的对象: \n ")
  227.           )
  228.           (setq q# (ssget (quote ((-4 . "<not") (0 . "viewport")
  229.                                   (-4 . "not>")
  230.                                  )
  231.                           )
  232.                    )
  233.           )
  234.           (if (/= q# nil)
  235.             (progn
  236.               (command "mspace")
  237.               (if (> (length (vports)) 2)
  238.                 (if (= qj 1)
  239.                   (getpoint (strcat "\n \n \n发现" (itoa (- (length
  240.                                                                 (vports)
  241.                                                         ) 1
  242.                                                      )
  243.                                                ) " 个视口.\n \n请在需要复制到的视口内指定一点: "
  244.                             )
  245.                   )
  246.                   (getpoint (strcat "\n \n \n发现" (itoa (- (length
  247.                                                                 (vports)
  248.                                                         ) 1
  249.                                                      )
  250.                                                ) " 个视口.\n \n请在需要移动到的视口内指定一点: "
  251.                             )
  252.                   )
  253.                 )
  254.               )
  255.               (if (= qj 1)
  256.                 (princ "\n \n正在复制. \n \n请等待...")
  257.                 (princ "\n \n正在移动. \n \n请等待...")
  258.               )
  259.               (command "pspace")
  260.               (setq q$ (ssget "x" (list (cons 0 "viewport"))))
  261.               (while (= q1 nil)
  262.                 (setq qo (ssname q$ 0))
  263.                 (setq q| (entget qo (quote ("acad"))))
  264.                 (setq q% (cadr (assoc (quote -3) q|)))
  265.                 (setq qjj (rtos (/ (cdr (nth 7 q%)) (cdr (assoc
  266.                                                                 (quote 41)
  267.                                                                 q|
  268.                                                          )
  269.                                                     )
  270.                                 ) 2 6
  271.                           )
  272.                 )
  273.                 (if (= (cdr (assoc (quote 68) q|)) 2)
  274.                   (setq q1 1)
  275.                 )
  276.                 (ssdel qo q$)
  277.               )
  278.               (setq qqj (cdr (assoc (quote 10) q|)))
  279.               (setq q@@ (getvar "ucsname"))
  280.               (command "ucs" "world")
  281.               (setvar "highlight" 0)
  282.               (if (= qj 1)
  283.                 (command "block" "to-modelspace" qqj q# "" "oops")
  284.                 (command "block" "to-modelspace" qqj q# "")
  285.               )
  286.               (if (= q@@ "")
  287.                 (command "ucs" "world")
  288.                 (command "ucs" "r" q@@)
  289.               )
  290.               (command "mspace")
  291.               (setq qq@ (getvar "ucsname"))
  292.               (command "ucs" "view")
  293.               (setq q0 (getvar "viewctr"))
  294.               (command "insert" "*to-modelspace" q0 qjj "0")
  295.               (if (= qq@ "")
  296.                 (command "ucs" "world")
  297.                 (command "ucs" "r" qq@)
  298.               )
  299.               (princ "\n \n \n ")             
  300.               (princ "\n \n \n完成... ")
  301.             )
  302.             (progn
  303.               (princ "\n \n \n")
  304.               (alert "你没有选择对象!")
  305.             )
  306.           )
  307.           (if (= q& 1)
  308.             (command "pspace")
  309.             (command "mspace")
  310.           )
  311.         )
  312.       )
  313.     )
  314.   
  315.   (setvar "expert" q@)
  316.   (setvar "cmdecho" ql)
  317.   (setvar "osmode" qq)
  318.   (setvar "highlight" 1)
  319.   (setq q@ nil
  320.         qq nil
  321.         q& nil
  322.         q1 nil
  323.         q# nil
  324.         q0 nil
  325.         q$ nil
  326.         qo nil
  327.         q| nil
  328.         q% nil
  329.         q?J nil
  330.         qjj nil
  331.         q@j nil
  332.         qqj nil
  333.         qlj nil
  334.         q&j nil
  335.         q1j nil
  336.         q#j nil
  337.         q0j nil
  338.         q$j nil
  339.         qoj nil
  340.   )
  341.   (princ)
  342. )
  343. (defun sp2sp_reset ()
  344.   (setq *error* q?@)
  345.   (princ "\n \n \n")
  346.   (if (= qq@)
  347.     (command "mspace" "ucs" "r" qq@)
  348.   )
  349.   (if (= q@@)
  350.     (command "pspace" "ucs" "r" q@@)
  351.   )
  352.   (if (= q& 1)
  353.     (command "pspace")
  354.     (command "mspace")
  355.   )
  356.   (setvar "expert" q@)
  357.   (setvar "cmdecho" ql)
  358.   (setvar "osmode" qq)
  359.   (setvar "highlight" 1)
  360.   (setq q@ nil
  361.         qq nil
  362.         ql nil
  363.         q& nil
  364.         q1 nil
  365.         q# nil
  366.         q0 nil
  367.         q$ nil
  368.         qo nil
  369.         q| nil
  370.         q% nil
  371.         q?J nil
  372.         qjj nil
  373.         q@j nil
  374.         qqj nil
  375.         qlj nil
  376.         q&j nil
  377.         q1j nil
  378.         q#j nil
  379.         q0j nil
  380.         q$j nil
  381.         qoj nil
  382.   )
  383.   (princ "\n \n \necs trapped the error \n")
  384.   (princ)
  385. )
  386. (princ "\n \n \nc2p = 复制到图纸空间 & m2p = 移动到图纸空间\nc2m = 复制到模型空间(视口) & m2m = 移动到模型空间(视口)")
  387. (princ)
 楼主| 发表于 2015-8-14 16:36:06 | 显示全部楼层
edata 发表于 2015-8-14 16:33
你试试这个

谢谢前辈!回头试试,我上面的程序知道怎么修改吗?
发表于 2015-8-14 16:40:34 | 显示全部楼层
CAD不是自带命令吗
 楼主| 发表于 2015-8-14 16:44:07 | 显示全部楼层
edata 发表于 2015-8-14 16:33
你试试这个

谢谢前辈,刚才使用了一下,“c2m = 复制到模型空间(视口)”不是我想要的结果!我想拷贝过去后,图元的相对位置和角度和在布局空间显示的一样的。您提供的程序拷贝到模型空间还需要指点基点,且当视口有旋转角度角度的时候相对角度也会不一样。
 楼主| 发表于 2015-8-14 16:45:53 | 显示全部楼层
rhww 发表于 2015-8-14 16:40
CAD不是自带命令吗

自带?命令是什么?

点评

http://www.ellenfinkelstein.com/acadblog/move-objects-between-model-and-paper-space/  发表于 2015-8-14 18:39
chspace  发表于 2015-8-14 18:39
发表于 2015-8-14 17:21:31 | 显示全部楼层
CAD自带命令
 楼主| 发表于 2015-8-14 17:29:57 | 显示全部楼层
429014673 发表于 2015-8-14 17:21
CAD自带命令

自带?命令是什么?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-21 09:53 , Processed in 0.243610 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表