Jump to content

Argument Not Passing Correctly When UCS Is Moved Away From World Position


Bill Tillman

Recommended Posts

I'm tinkering around with this code


(defun C:TEST ( / pt1)

  (setq pt1 '(0.0 0.0 0.0)

            a270 (dtr 270.)
    )

  (M-Text pt1 "This is the text" a270)
 
  (princ)
  ); end

 

(defun M-Text (pt val rot)
 (entmakex
   (list
     (cons 0   "MTEXT")         
     (cons 100 "AcDbEntity")          
     (cons 100 "AcDbMText")    
     (cons 1 val)
     (cons 7 "ARCHSTYL")
     (cons 8 "Defpoints")
     (cons 10 pt)
     (cons 50 (dtr rot))
     (cons 40 2)     
     )))

 

This works like I planned, but one of the things I need to do is to move the UCS to another location and run it again from there. With the code now using the new location of the UCS as '(0.0 0.0 0.0). But for some reason when I call the routine M-Text after the UCS has been moved it does all it's supposed to do with the drawing and then when I want it to write the text the value of pt in the M-Text routine is '(2.20436e-15 12.0 0.0) and the text appears back as if the UCS is in the World position. Which at the moment it is not.

???

 

UPDATE: So I debugged and found that if I pass a value other than pt1 or '(0.0 0.0 0.0) to the M-Text function, the issue with the scientific notation goes away. However, the text still gets printed as though the UCS was back at the World position. There's a lot of other drawing which happens in this app and that all happens around the present location of the UCS. It's when I call this M-Text which uses entmakex to insert the block of text that this issue shows up.

Edited by Bill Tillman
Link to comment
Share on other sites

To correctly orient the MText with respect to the current UCS, you will need to supply the entmakex function with DXF group 210 (the extrusion vector or normal vector to the UCS plane), and I would also suggest using DXF group 11 (the direction vector for the MText object) to implement the MText rotation in lieu of DXF group 50 when working in UCS' which are not parallel to the WCS.

 

Here is a reference for these groups.

Edited by Lee Mac
Link to comment
Share on other sites

My $0.05  a270 (* 1.5 pi) as your using dtr why not make the obvious variables global a90 a180 a270 a45 etc in your library routine.

Edited by BIGAL
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...