(defun c:bbb (/ *error* o a e p )
;; RJP ≫ 2019-01-30
;; mod. M.R.
(defun *error* ( m )
(if o
(setvar (quote osmode) o)
)
(if m
(prompt m)
)
(princ)
)
(setq o (getvar (quote osmode)))
(setvar (quote osmode) 0) ; Set 'osmode' variable to 0
(while (setq p (getpoint "\nPick a point in a face : ")) ; Repeat until user picks a point
(setq a (entlast)) ; Store the last entity created, presumably a face
(vl-cmdf "_.Solidedit" "_Face" "_Copy" p "" (list 0.0 0.0 0.0) (list 0.0 0.0 0.0) "" "") ; Copy the face
(cond
( (eq a (setq e (entlast))) (print "Boundary not created..") ) ; If no boundary created
( (/= "REGION" (cdr (assoc 0 (entget e)))) ; If created boundary is not valid
(print "Boundary created not valid..")
)
( t
(vl-cmdf "_.ucs" "_OB" e) ; created boundary is REGION and UCS aligned to it
)
) ; End of cond
(if (not (eq a e))
(while (setq a (entnext a))
(if (and a (not (vlax-erased-p a)))
(entdel a)
)
) ; Delete REGION or not valid boundary created after (setq a (entlast))
) ; End of if
) ; End of while loop
(*error* nil)
) ; End of defun
I've changed the code slightly to remove REGION after face is beeing copied...
I don't know how do you get 'ucsydir not aligned to edge of face - region... Both X and Y should be aligned to edges and Z with normal axis from inner to outer of 3dsolid...
Look, I am using BricsCAD and whereever I pick point on 3dsolid - BOX my both X and Y axises are aligned to edges of BOX... Haven't tested it with AutoCAD - give me a minute to try...
It seems that AutoCAD is buggy with this code... In BricsCAD it alignes UCS to region and in AutoCAD it reports that this object don't define coordinate system... And to be even more buggy it doesn't remove created regions after solidedit - copy - face options...Thank you, I learned a lot of information from you.