Mike Krous
Usenet Archive
- Joined
- Sep 11, 2003
- Messages
- 3
- Reaction score
- 0
I am trying to convert a circle entity to a lwpline entity so it may be used by a routine that only likes plines...I am having problems converting from the circle information to lwpline information. My script takes a circle and converts it to an lwpline...anyone know where im going wrong? It works sometimes but alot of the time it just gives me odd shaped arcs.
(edata holds a circle entity, ename holds the entity name) .... (setq cenPt (getdxf 10 edata)) ;get centerpoint (setq rad (getdxf 40 edata)) ;get radius (setq startPt (polar cenPt 0 rad)) ;get the point at 0 degrees (setq endPt (polar cenPt pi rad)) ;get the point at 180 degrees (command "pline" startPt "a" "ce" cenPt endPt "") ;draw a pline from 0 degrees to 180 degrees (setq ent1 (entlast)) ;get our newly created entity for later join to ent2 (command "pline" endPt "a" "ce" cenPt startPt "") ;draw a pline from 180 degrees to 0 degrees (setq ent2 (entlast)) ;get our newly created entity for later join to ent1 (command "pedit" ent1 "j" ent2 "" "") ;join ent1 and ent2 to create our new "pline-circle" (entdel ename) ;get rid of the original circle .... ;--------------------------------------------------------------------------- (defun getdxf (dxfcode ent) (cdr (assoc dxfcode ent))
)
All suggestions are appreciated.
Mike Krous
(edata holds a circle entity, ename holds the entity name) .... (setq cenPt (getdxf 10 edata)) ;get centerpoint (setq rad (getdxf 40 edata)) ;get radius (setq startPt (polar cenPt 0 rad)) ;get the point at 0 degrees (setq endPt (polar cenPt pi rad)) ;get the point at 180 degrees (command "pline" startPt "a" "ce" cenPt endPt "") ;draw a pline from 0 degrees to 180 degrees (setq ent1 (entlast)) ;get our newly created entity for later join to ent2 (command "pline" endPt "a" "ce" cenPt startPt "") ;draw a pline from 180 degrees to 0 degrees (setq ent2 (entlast)) ;get our newly created entity for later join to ent1 (command "pedit" ent1 "j" ent2 "" "") ;join ent1 and ent2 to create our new "pline-circle" (entdel ename) ;get rid of the original circle .... ;--------------------------------------------------------------------------- (defun getdxf (dxfcode ent) (cdr (assoc dxfcode ent))
)
All suggestions are appreciated.
Mike Krous