明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1233|回复: 2

[提问] 直線思路尋求解答

[复制链接]
发表于 2014-7-26 12:36:23 | 显示全部楼层 |阅读模式
各位大神
想請教思路如何做到下列情形




簡單說我想要藉由使用者取得兩點 (basepointX, basepointY)
再取得使用者想要的寬度(width)
不管形成的角度如何  都保持四角都是90度
但實際情形我卻做成了右邊的情況
估計是我搞錯了角度旋轉的問題
有請大神協助!

本帖子中包含更多资源

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

x
发表于 2014-7-26 13:38:19 | 显示全部楼层
  1. (defun c:tt(/ BasePtX BasePtY width ang1 offsetx1 offsetx2 offsety1 offsety2)
  2.   (if(and(setq BasePtX(getpoint "BasePtX: "))
  3.          (setq BasePtY(getpoint BasePtX "BasePtY: "))
  4.          )
  5.     (progn
  6.       (setq width (cond((getdist "Enter width<10>: " ))(10)))
  7.       (setq ang1(angle BasePtX BasePtY))
  8.       (setq offsetx1(polar BasePtX (+ ang1(* pi 0.5)) (* width 0.5))
  9.             offsetx2(polar BasePtX (+ ang1(* pi 1.5)) (* width 0.5))
  10.             offsety1(polar BasePtY (+ ang1(* pi 1.5)) (* width 0.5))
  11.             offsety2(polar BasePtY (+ ang1(* pi 0.5)) (* width 0.5))
  12.             )
  13.       (command "pline" "non" offsetx1 "non" offsetx2 "non" offsety1 "non" offsety2 "c")
  14.       )
  15.     )
  16.   (princ)
  17.   )

评分

参与人数 1明经币 +1 收起 理由
风树 + 1 助人为乐啊

查看全部评分

 楼主| 发表于 2014-7-26 13:41:13 | 显示全部楼层
edata 发表于 2014-7-26 13:38

謝謝e神!
馬上茅塞頓開!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-24 09:25 , Processed in 0.165822 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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