明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: cj52000

[求助]如何从封闭多段线偏移某个线段或圆弧?

  [复制链接]
 楼主| 发表于 2010-6-12 09:45:00 | 显示全部楼层
各位来帮帮忙啊!谢`
 楼主| 发表于 2010-6-13 10:57:00 | 显示全部楼层

在线等,高人来支招啊!

发表于 2010-6-14 13:44:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2010-6-14 23:46:00 | 显示全部楼层

网上找的,

;;; 平移复制所选取的多义线的一段,

(defun c:XV ()
  (setvar "cmdecho" 0)
  (setq temp (if (null of_pl_dist)
        (getdist "\n请输入平移距离<>:")
        (getdist (strcat "\n输入平移的距离<" (rtos of_pl_dist) ">:"))
      )
 of_pl_dist (if (null temp)
       of_pl_dist
       temp
     )
 select_pline (entsel)
  )
  (while (and
    (/= select_pline nil)
    (= (cdr (assoc 0 (entget (car select_pline)))) "LWPOLYLINE")
  )
    (segmentoffset (car select_pline) (cadr select_pline) of_pl_dist)
    (setq select_pline (entsel))
  )
  (setvar "cmdecho" 1)
  (princ)
)

;;; OFFSET多义线所点击的子段
(defun segmentoffset (ename p oo)
  (setq p2 (getpoint "\ndirection of offset:"))
  (vl-cmdf "explode" ename)
  (vl-cmdf "offset" oo p      p2 "")
  (setq entl (entget (entlast)))
  (vl-cmdf "undo" 2)
  (entmake (cdr entl))        

)

发表于 2010-6-15 20:23:00 | 显示全部楼层
 也来凑个数
(defun c:of (/ di d etl en p na en1 ent1 en2 po)
  (setq di (getvar "offsetdist"))
  (setq d (getreal (strcat "\n请指定偏距[" (rtos di) "]:")))
  (if (null d)
    (setq d di)
  )
  (while
    (setq etl (entsel "\n选择要偏移的图元:"))
     (setq en (car etl)
       p  (cadr etl)
     )
     (setq ent (entget en))
     (setq na (cdr (assoc 0 ent)))
     (if (= na "LWPOLYLINE")
       (progn
     (command "undo" "m")
     (command "explode" en)
     (setq en1 (ssname (ssget p) 0))
     (setq ent1 (entget en1))
     (command "undo" "b")
       )
     )
     (entmake ent1)
     (setq en2 (entlast))
     (command "offset" d en2 (setq po (getpoint "\n指定方向点:")) "")
     (command"erase" en2 "")
  )
  (princ)
)
发表于 2010-6-15 20:58:00 | 显示全部楼层

我搞了个动态偏移的,可能断了有些人的财路,呵呵。

没有用vla-offset, 也没用command

 

本帖子中包含更多资源

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

x
发表于 2010-6-15 21:13:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2010-6-15 22:38:00 | 显示全部楼层
enmake 在非世界坐标系 会出错 用绘制吧
发表于 2010-6-15 22:40:00 | 显示全部楼层
咋回事 登陆还是匿名
发表于 2010-6-15 22:42:00 | 显示全部楼层
客人(121.77.*.*)发表于2010-6-15 22:38:00enmake 在非世界坐标系 会出错 用绘制吧

说得对,这点应该考虑的,稍微修改了下, 加两句 (setq pt0 (trans pt0 1 0))可以解决这个问题

本帖子中包含更多资源

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

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-29 05:19 , Processed in 0.151788 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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