Extract Matrix3D from a Solid3D/Entity?

Extract Matrix3D from a Solid3D/Entity?

Anonymous
Not applicable
676 Views
5 Replies
Message 1 of 6

Extract Matrix3D from a Solid3D/Entity?

Anonymous
Not applicable
Anybody have a good solution to how to extract the rotation from a Solid3D/Entity? The best would be to get it as a Matrix3D format, but as I am not able to get anything I can probobly live with vectors/angles also.

So, from Entity I find something called ent.Esc but this is all the time returning rotation as 0.

From a Solid3D object I can't get any Matrix3D at all.

So if someone can clear this up I would be greatful!

/Markus
0 Likes
677 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
I have worked with Solid3D too. So I save in 1011 Xdata code the origin point, xaxis point and yaxis point defined by myself. So, if I move, rotate, etc the solid3D object the 1011 xdatas update. So, i can to retrieve the 1011 xdatas and find the matrix3D. Understand me?

Cherrs.

Luizoo
0 Likes
Message 3 of 6

Anonymous
Not applicable
The 'real' Matrix for a 3dsolid is in another database object that's part of the 3dsolid's data, but is hidden from all APIs except DXF, so the only way to get at it is via acedEntGet(). The LISP code below returns the entity data of that object for a selected solid. The 16 elements of the solid's matrix are in group codes 40 through 55. The origin of the coordinate system defined by the matrix is the solid's centroid.

(defun C:SOLDATA ()

(setq idSolid (car (entsel "\nSelect a 3DSolid: ")))

(setq Solid (entget idSolid))

(setq idHistory
(cdr (assoc 350 (member '(100 . "AcDb3dSolid") Solid)))
)

(setq History (entget idHistory))

(setq idEvalGraph
(cdr (assoc 360 (member '(100 . "AcDbShHistory") History)))
)

(setq EvalGraph (entget idEvalGraph))

(setq idEvalExpr
(cdr (assoc 360 (member '(100 . "AcDbEvalGraph") EvalGraph)))
)

(setq EvalExpr (entget idEvalExpr))

(textscr)

(princ "\n\n3DSOLID Primitive data:\n")

(foreach pair EvalExpr
(print pair)
)
(princ "\n")

(princ)
)


Here's a video that shows how the data was found:

http://www.caddzone.com/3dSolidHistory.wmv


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5852960@discussion.autodesk.com...
Anybody have a good solution to how to extract the rotation from a Solid3D/Entity? The best would be to get it as a Matrix3D format, but as I am not able to get anything I can probobly live with vectors/angles also.

So, from Entity I find something called ent.Esc but this is all the time returning rotation as 0.

From a Solid3D object I can't get any Matrix3D at all.

So if someone can clear this up I would be greatful!

/Markus
0 Likes
Message 4 of 6

bikelink
Contributor
Contributor
How can I get the member IdHistory in a dot.net program ?
I'm not able to find it.
It's possibile to perform the same code in .net code ?
Thank You in advice
0 Likes
Message 5 of 6

Anonymous
Not applicable
You have to P/Invoke acdbEntGet(), and then look for the 360 group (ObjectId) in the result buffer it returns.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:5986249@discussion.autodesk.com...
How can I get the member IdHistory in a dot.net program ?
I'm not able to find it.
It's possibile to perform the same code in .net code ?
Thank You in advice
0 Likes
Message 6 of 6

bikelink
Contributor
Contributor
I don't understood this solution..
What do You store in 1011 code ?
(point xaxis-point yaxis-point ) ?
0 Likes