Jump to content

MTEXT normal value. Is it possible to change this to 0


3dwannab

Recommended Posts

I'm having a fuzzy MTEXT problem found here.

 

It turns out MTEXT has a normal value. This is the cause of the problem, FLATTEN doesn't work, nor changing the Z value of the text.

 

I thought there might be a way with LISP.

 

Cheers.

Link to comment
Share on other sites

If something has a normal (other than 0) then it was created on another UCS, use the UCS command and the option 'object' select the text and then copy it with base point. reset the UCS to world and paste the mtext now back to the world UCS

Link to comment
Share on other sites

If something has a normal (other than 0) then it was created on another UCS, use the UCS command and the option 'object' select the text and then copy it with base point. reset the UCS to world and paste the mtext now back to the world UCS

 

That worked but I'm stumped on how to do this on objects with different UCS vals. A LISP would be more beneficial here. Thanks.

 

Here's the entget info for that MTEXT. Nowhere does it list the NORMAL. :unsure:

 

((-1 . <Entity name: 21e6398f230>) (0 . "MTEXT") (5 . "383") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 21e6398f240>) (102 . "}") (330 . <Entity name: 21e08fde020>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Defpoints") (100 . "AcDbMText") (10 -178.686 5455.27 -1.24456e-05) (40 . 600.0) (41 . 12000.0) (46 . 0.0) (71 . 2) (72 . 5) (1 . "REAR ELEVATION KINGS ROAD (FuZzy TeXt, Z value is at 0, I need to explode it for it to work and put Z val as 0)") (7 . "Standard") (210 -9.71234e-13 -7.41855e-09 1.0) (11 1.0 1.99153e-16 9.71234e-13) (42 . 11680. (43 . 3818.14) (50 . 1.99153e-16) (73 . 1) (44 . 1.0))

Link to comment
Share on other sites

based on the helpfile (zero expercience with normal)

 

(defun c:normal ( / mtext-object mtext-normal newNormal)
 (if (setq mtext-object (vlax-ename->vla-object (car (entsel))))
   (progn
     (setq mtext-normal (vlax-variant-value (vla-get-Normal mtext-object)))
     (alert (strcat "Normal mtext object is "
                    (rtos (vlax-safearray-get-element mtext-normal 0) 2) ", "
                    (rtos (vlax-safearray-get-element mtext-normal 1) 2) ", "
                    (rtos (vlax-safearray-get-element mtext-normal 2) 2)))
     (setq newNormal (vlax-3d-point 0 0 1))
     (vla-put-Normal mtext-object newNormal)
     (vla-Update mtext-object)
     (setq mtext-normal (vlax-variant-value (vla-get-Normal mtext-object)))
     (alert (strcat "Normal mtext object is "
                    (rtos (vlax-safearray-get-element mtext-normal 0) 2) ", "
                    (rtos (vlax-safearray-get-element mtext-normal 1) 2) ", "
                    (rtos (vlax-safearray-get-element mtext-normal 2) 2)))
   )
 )
)

gr.Rlx

Link to comment
Share on other sites

I see that now.

 

(210 -9.71234e-13 -7.41855e-09 1.0)

was throwing me off. I was expecting its true value. 0.0000000001 :rofl:

Link to comment
Share on other sites

based on the helpfile (zero expercience with normal)

Enough for you to get it to work. Thanks very much.

 

 

Here's the dwg file for testing: Fuzzy Text Problem.dwg

 

Now to see if I can get this to work with multiple selections.

 

A lil' extra step was needed in the code.

(defun c:normal ( / mtext-object mtext-normal newNormal)
(if (setq mtext-object (vlax-ename->vla-object (car (entsel))))
	(progn
		(setq mtext-normal (vlax-variant-value (vla-get-Normal mtext-object)))
		(alert (strcat "Normal mtext object is "
			(rtos (vlax-safearray-get-element mtext-normal 0) 2) ", "
			(rtos (vlax-safearray-get-element mtext-normal 1) 2) ", "
			(rtos (vlax-safearray-get-element mtext-normal 2) 2)))
		(setq newNormal (vlax-3d-point 0 0 1))
		(vla-put-Normal mtext-object newNormal)
		(vla-Update mtext-object)
		(setq mtext-normal (vlax-variant-value (vla-get-Normal mtext-object)))
		(alert (strcat "Normal mtext object is "
			(rtos (vlax-safearray-get-element mtext-normal 0) 2) ", "
			(rtos (vlax-safearray-get-element mtext-normal 1) 2) ", "
			(rtos (vlax-safearray-get-element mtext-normal 2) 2)))

		; EXTRA STEP: To move the object up then down.
		(command "_.UCS" "")
		(command "_.move" (vlax-vla-object->ename mtext-object) "" '(0 0 1e99) ""
			"_.move" "_p" "" '(0 0 -1e99) "")
		)
	)
)

Link to comment
Share on other sites

Run on the command line

((lambda (edata)
 (entmod (subst (cons 210 '(0 0 1)) (assoc 210 edata) edata)))
(entget (car (entsel))))

 

Nice, that does it all in one go. I'm going to use this and try see if I can filter the selection for non 0 0 1 vals for the normal and do it for more than just one object. Thanks very much.

Link to comment
Share on other sites

based on the helpfile (zero expercience with normal)

(setq mtext-normal (vlax-variant-value (vla-get-Normal mtext-object)))

gr.Rlx

 

FWIW

(setq mtext-normal (vlax-get  mtext-object 'Normal ) )

returns listp so no need vlax-variant-value conversion, save long typing :P

Link to comment
Share on other sites

FWIW

(setq mtext-normal (vlax-get  mtext-object 'Normal ) )

returns listp so no need vlax-variant-value conversion, save long typing :P

 

I like short(er) lines :thumbsup: . thanx!

 

(one of the little terro's fell asleep in my arms so couldn't respond right away... but her mommy arrived , finally ...)

 

Have a nice weekend

 

gr. Rlx

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...