JY 大大的需求是,需要把 output 的座標值,
由 原先的 世界座標,轉換成 當時的 UCS 座標,
需要用到以下的 AutoLISP 系統所提供的 函數。
(setq p2 (trans p1 0 1))
; 然後,把 p2 write 出去,即為所求。
以下為 AutoCAD 2010 版,關於 (trans ) 的部份解釋。
Translates a point (or a displacement) from one coordinate system to another
(trans pt from to [disp])
Arguments
pt
A list of three reals that can be interpreted as either a 3D point or a 3D
displacement (vector).
from
An integer code, entity name, or 3D extrusion vector identifying the
coordinate system in which pt is expressed. The integer code can be one of
the following:
0 World (WCS)
1 User (current UCS)
2 If used with code 0 or 1, this indicates the Display Coordinate System
(DCS) of the current viewport. When used with code 3, it indicates the DCS of
the current model space viewport.
3 Paper space DCS (used only with code 2)
※ 引述《jyhchyunlu (jyhchyunlu)》之銘言:
: 這幾天為了做一份報告
: 需要把AUTOCAD上點的座標值匯出成TXT檔
: 於是開始上板上爬文
: 結果找了一篇2007年 sjgau板友發表的文章
: 用AUTOLISP擷取座標直
: 原本就對AUTOCAD不熟的我
: 第一次聽到AUTOLISP覺得很新奇
: 也覺得這種東西很厲害
: 可以依照自己的需求去寫程式
: 完成AUTOCAD自身很難完成的事情
: 於是在此推薦新手
: 如果在AUTOCAD上有特殊需求
: 可以朝著AUTOLISP這方面去解決問題
: 熟練的話
: 這會是一個很強大的功能
: 在此也謝謝sjgau板友
: 不但提供程式
: 還幫我修改成完整符合我所需的功能
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.20.138.178