Eh!
BricsCAD can run Python?
Setting UCS
Hi all
I want to set ucs with coordinates 100,50,0 X axis is X plus direction Y axis is Z plus direction in UCS command In AutoCAD,
it was realized by the following program In BricsCAD,
how should I do?
Thank you.
(defun c:test1 (/ bp np xc)
(setq bp (list 100 50 0))
(setq np (list 110 50))
(setq xc (mapcar '- bp np)) ;(10 0)
(command "._ucs" bp xc "0,10")
)
Comments
-
(defun c:test1 (/ gp xc yc)
(setq gp (list 100 50 0))
(setq xc (list 125 50 0))
(setq yc (list 100 50 10))(command "UCS" gp xc yc)
)Why doesn't this programme work?
0 -
The above codes seem to work for me, not sure why you say it does not work. Is there more to this request?
0 -
When I run TEST1 in Lisp, it returns nil on the Y-axis setting and stops in a waiting state (image 1).
What I would like is for Lisp to behave like in image 2, typed on the command line.The Y-axis is the position of the Z-axis of the world UCS
Thank you.
Sorry, I've corrected my second post.(setq yc (list 100 60 10)) wrong
(setq yc (list 100 50 10)) Correct
0 -
How about vla-put-ActiveUCS?
In python you can use Ed.Editor.setCurrentUCS, example
import traceback from pyrx_imp import Rx, Db, Ge, Gi, Db, Ap, Ed def PyRxCmd_doit(): try: o = Ge.Point3d(100, 100, 100) x = Ge.Vector3d.kXAxis y = Ge.Vector3d.kYAxis z = Ge.Vector3d.kZAxis xf = Ge.Matrix3d() xf.setCoordSystem(o, z, y, x) Ed.Editor.setCurrentUCS(xf) except Exception as err: traceback.print_exception(err)
0 -
Eh!
BricsCAD can run Python?0 -
I changed the previous program to output a string instead of a List!
However, the result was exactly the same.
What is the problem with this?(defun c:test1 (/ gpl xcl ycl gps xcs ycs)
(setq gp (list 100 50 0))
(setq xc (list 125 50 0))
(setq yc (list 100 50 10))(setq gpS (lst-to-xyz gp))
(setq xcS (lst-to-xyz xc))
(setq ycs (lst-to-xyz yc))(command "UCS" gps xcs ycs)
)
(defun lst-to-xyz (lst)
(cond
((= (length lst) 2)
(strcat (rtos (car lst)) "," (rtos (cadr lst)) ",0"))
((= (length lst) 3)
(strcat (rtos (car lst)) "," (rtos (cadr lst)) "," (rtos (caddr lst))))
(t nil)
)
): TEST1
: UCS
UCS原点を指定、または [面 (F)/名前付き (NA)/図形 (E)/点群 (PO)/前 (P)/ビュー (V)/X/Y/Z/z軸 (ZA)/移動 (M)/ワールド座標 (W)] <ワールド座標 (W)>: 100,50,0
X軸上を指示、または <承諾>: 125,50,0
XY-平面上のYの正方向を指示、または <承諾>: 100,50,10
原点と等価
XY-平面上のYの正方向を指示、または <承諾>: nil
XY-平面上のYの正方向を指示、または <承諾>:0 -
have a look at
0 -
Hi Saitoib
I used the lisp code you provided and had no problems at all. The command ended as intended so not sure what is happening at your end. Here is what the command trail looks like for me
: TEST1
: UCS
Specify origin of UCS or [Face/NAmed/Entity/POintcloud/Previous/View/X/Y/Z/Z Axis/Move/World] <World>: 100,50,0
Point on X-axis or <Accept>: 125,50,0
Point on the XY-plane with positive Y value or <Accept>: 100,50,10nilIn your case I can see the last value is not being accepted and so the prompt repeats itself. Also, in the 1st snapshot I cannot see the values on the commandline so it is hard to tell if things are working but given the command progresses meaning something is getting accepted. I believe your code works and the problem is located somewhere else, maybe you have others reactor-based lisp routines that jump in or something
Hope you find the issue
0 -
Thank you for testing it!
I will look into the cause.0