PDA

View Full Version : Entmake UCS


Takuwind
2006-08-04, 07:40 PM
How do you entmake a UCS?

I have tried many variations, but none work:

(entmake '((0 . "UCS") (2 . "Test 4") (70 . 0) (10 81.6946 16.0317 0.0) (11 0.95056 0.310541 0.0) (12 -0.310541 0.95056 0.0) (79 . 0) (146 . 0.0)))

(entmake '((0 . "UCS") (2 . "Test 4") (70 . 0) (10 81.6946 16.0317 0.0) (11 0.95056 0.310541 0.0) (12 -0.310541 0.95056 0.0) (79 . 0) (146 . 0.0)))

(entmake '((100 . "AcDbUCSTableRecord") (0 . "UCS") (2 . "Test 4") (10 81.6946 16.0317 0.0) (11 0.95056 0.310541 0.0) (12 -0.310541 0.95056 0.0) (146 . 0.0)))

(entmake '((0 . "UCS") (2 . "Test 4") (10 81.6946 16.0317 0.0) (11 0.95056 0.310541 0.0) (12 -0.310541 0.95056 0.0) (146 . 0.0)))

etcetera etcetera etcetera....

miff
2006-08-04, 09:03 PM
This worked for me:

(entmake '((0 . "UCS") (100 . "AcDbSymbolTableRecord") (100 . "AcDbUCSTableRecord")
(2 . "test") (70 . 0) (10 7.61537 9.4732 0.0) (11 0.516992 0.85599 0.0)
(12 -0.85599 0.516992 0.0) (79 . 0) (146 . 0.0)))

intergrupocr
2006-08-04, 09:11 PM
Did you try the Visual Lisp way?


An example:


(defun ucsadd (name / acaddoc ucss item)
(vl-load-com)
(setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
(setq ucss (vla-get-UserCoordinateSystems acaddoc))
(setq item (vla-add ucss
(vlax-3d-point '(0.0 0.0 0.0)) ;;origin
(vlax-3d-point '(1.0 0.0 0.0)) ;;x axis
(vlax-3d-point '(0.0 1.0 0.0)) ;;y axis
name ;;name
) ;_ end of vla-add
) ;_ end of setq
(princ)
) ;_ end of defun


If you type (ucsadd "test4") you will have a new ucs called test 4. I change the values you give because x and y values are not perpendicular and makes an error:

error: Automation Error. UCS X axis and Y axis are not perpendicular.

Takuwind
2006-08-04, 09:29 PM
Sorry, but I dont speak VL...
Thanks tho

Did you try the Visual Lisp way?

....

Takuwind
2006-08-04, 09:32 PM
Ur a genius!
I NEVER would have guessed that. How do i figure that out? Guesswork? Is it in the ACAD Help file, because I could not find it.
I was taking the data I got from tblnext and trying to turn around and use it for entmake...


This worked for me:

(entmake '((0 . "UCS") (100 . "AcDbSymbolTableRecord") (100 . "AcDbUCSTableRecord")
(2 . "test") (70 . 0) (10 7.61537 9.4732 0.0) (11 0.516992 0.85599 0.0)
(12 -0.85599 0.516992 0.0) (79 . 0) (146 . 0.0)))

miff
2006-08-04, 09:55 PM
Ur a genius!
I NEVER would have guessed that. How do i figure that out? Guesswork? Is it in the ACAD Help file, because I could not find it.
I was taking the data I got from tblnext and trying to turn around and use it for entmake...
Aw shucks!
Nope, I don't like guessing.....first I listed what is stored in the UCS Table for an existing UCS...which is what you were trying to do but (tblsearch) only returns SOME of the entity list, (entget (tblobjname ......)) get the WHOLE enchilada:

Command: (setq ent (entget (tblobjname "UCS" "sbd")))
((-1 . <Entity name: 400bfe58>) (0 . "UCS") (330 . <Entity name: 400bfc38>) (5
. "7B") (100 . "AcDbSymbolTableRecord") (100 . "AcDbUCSTableRecord") (2 .
"sbd") (70 . 0) (10 7.61537 9.4732 0.0) (11 0.516992 0.85599 0.0) (12 -0.85599
0.516992 0.0) (79 . 0) (146 . 0.0))
Then I stripped out the stuff I know isn't used, such as <ename> & handle, and changed the name to "test". Then I tried (entmake) with that list and yep, it worked.

miff
2006-08-04, 10:01 PM
Oh, and the help does mention needing whatever group 100 codes are required to define the object:

For entity types introduced in AutoCAD Release 13 and later releases, you must also specify subclass markers (DXF group code 100) when creating the entity. All AutoCAD entities have the AcDbEntity subclass marker, and this must be explicitly included in the entmake list. In addition, one or more subclass marker entries are required to identify the specific sub-entity type. These entries must follow group code 0 and must precede group codes that are specifically used to define entity properties in the entmake list. For example, the following is the minimum code required to entmake an MTEXT entity: .... and with the DXF reference you can see that all Table objects use the 100 . "AcDbSymbolTable" and te UCS in particular uses 100 . "AcDbUCSTableRecord"