Author Topic: Block insertion & orientation error  (Read 1322 times)

0 Members and 1 Guest are viewing this topic.

uft12

  • Mosquito
  • Posts: 1
Block insertion & orientation error
« on: April 27, 2020, 06:47:08 AM »
I am trying to insert a block using the entmake method. The block must be inserted on a specific point as well as with a specific orientation, meaning that the block must be rotated in 3D space for correct placement. I have the UCS (or WCS) point to insert it, I have the normal vector (e.g. 210 dxf code) that needs to be oriented but for some strange reason I can only either correctly place it or orient it, not both. This is the short code I am using

Code: [Select]
(entmakex
(list
(cons 0 "INSERT")
(cons 2 "S1")
(cons 8 "0")
(cons 10 pt)
(cons 70 0)
(cons 66 1)
(cons 50 0)
(cons 210 v)
)
)
(entmakex '((0 . "SEQEND")))

 The pt is expressed in the currect UCS (or WCS) and v is the normal vector (in this case it happens to be '(0.347329 0.14033 0.927184). The block is a dwg file saved in library with a normal vector of '(0.0 0.0 1.0).

 

Any suggestions appreciated.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Block insertion & orientation error
« Reply #1 on: April 27, 2020, 08:16:58 AM »
The coordinates defining the insertion point for a block reference (DXF group 10) (and indeed, those defining the geometry for many other planar entities) should be expressed relative to the Object Coordinate System (OCS), not the UCS/WCS; I've recently provided this brief explanation of the OCS, which you may find useful in this regard.

Essentially, assuming that your variable pt is expression relative to the UCS, you can transform it to the OCS using:
Code - Auto/Visual Lisp: [Select]
  1. (cons 10 (trans pt 1 v))

Note that the SEQEND entity is not required unless you are also entmake'ing attribute references following the insert entity.