- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
A drawing contains a block. I want to insert another block at the same position and rotation angle of this block using AutoLisp. It very seems simple no ?
When I make LIST of this entity I get the Insertion point: X = 200.0000 Y = 100.0000 Z = 300.0000 which are the coordinates relative to the World UCS. The Rotation is 90°
I get the insertion point using Autolisp :
(setq ent(entsel "\n Select an entity: ")) ;- Let the user select a block
(setq en(car ent)) ;- Get the entity name of the block
(setq enlist(entget en)) ;- Get the DXF group codes
(princ "\n Entity DXF codes : ")(princ enlist)
I get this :
Entity DXF codes : ((-1 . <Entity name: b9c47cb0>) (0 . INSERT) (5 . 424) (330 . <Entity name: a6540540>) (100 . AcDbEntity) (67 . 0) (410 . Model) (8 . 0) (100 . AcDbBlockReference) (2 . TE_DN150_P) (10 -100.000 300.000 -200.000) (41 . 1.00000) (42 . 1.00000) (43 . 1.00000) (50 . 1.57080) (70 . 1) (71 . 1) (44 . 0.E+00) (45 . 0.E+00) (210 -1.00000 0.E+00 0.E+00))
To get the insertion point
(setq po(cdr (assoc 10 enlist)))
(princ "\n Insertion point: ")(princ po)
The result is -100.000 300.000 -200.000
If I use the INSERT command to insert another block at this position it will be wrong.
Use the trans function perhaps ?
(setq pt (trans po 0 1))
(princ "\n Corrected insertion point: ")(princ pt)
The result is still the same : -100.000 300.000 -200.000
Of course, I know, the problem is between to keyboard and the seat ….
My question : how can I get the right insertion point and rotation angle to INSERT a new block at the same location ?
Thanks for your help.
Solved! Go to Solution.