Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

editing the multileader text insertion point

7 REPLIES 7
Reply
Message 1 of 8
ajohnson
1236 Views, 7 Replies

editing the multileader text insertion point

Is there a way to modify the text insertion point of multileaders using lisp? We have a problem with some of our multileaders getting a landing distance set to a negative value.  My lisp routine will correct these to a default value, but then the text jumps a bit.  If I could get the insertion point prior to changing the landing distance then I could restore that point after changing the landing distance.

 

 

;;-------------------------------------------------------------------------------------------------

(defun c:zld  (/ e th dogleg doglegllength sf ss c mlss mlcount)
  (setq	ss	  (ssget (ssget "X" (list (cons 0 "MULTILEADER"))))
	DWATxtHgt (getvar "userr1")
	sf	  1
	dogleg	  (/ 3 32.0)
	th	  (if dwatxthgt
		    dwatxthgt
		    dogleg)
	c	  0
	mlcount   0
	mlss 	  (ssadd)
	)
  (IF ss
    (while (< c (sslength ss))
      (setq e (vlax-ename->vla-object (ssname ss c))
	    c (1+ c)
	    )
      (= (vla-get-ObjectName e) "AcDbMLeader")
      (progn
	;;change the dogleglength if less than zero to 3/32"
	(setq dogleglength (vla-get-dogleglength e))
	(princ "\nDogleg Length: ")
	(princ dogleglength)
	(if (< dogleglength 0)
	  (progn
	    (princ "\nChanged to: ")
	    (princ (vla-put-dogleglength e (* dogleg sf)))
	    (ssadd (ssname ss (1- c)) mlss)
	    (setq mlcount (1+ mlcount))
	    )
	  )

	)

      )
    )
  (command "select" mlss "")
  (princ (strcat "\nChanged " (itoa mlcount) " of " (itoa c) " multileaders. Select Previous to view changed multileaders...\n"))
  (princ)
  )

 

7 REPLIES 7
Message 2 of 8
hmsilva
in reply to: ajohnson

ajohnson wrote:

 

...If I could get the insertion point prior to changing the landing distance then I could restore that point after changing the landing distance...

 

a way to get the text insertion point of a multileader is:

 

(setq e (entget (car(entsel "\nSelect a multileader : "))))

(setq ptins (cdr (assoc 12 e)))

 

maybe you can change it with

 

(setq edta (subst (cons 12 ptins) (assoc 12 e) e))

(entmod edta)

 

not tested...

 

hope that helps

Henrique

EESignature

Message 3 of 8
hmsilva
in reply to: ajohnson

ajohnson wrote:

...We have a problem with some of our multileaders getting a landing distance set to a negative value.  My lisp routine will correct these to a default value, but then the text jumps a bit.  If I could get the insertion point prior to changing the landing distance then I could restore that point after changing the landing distance.

 

You wrote about landing distance, but you are changing the DoglegLength, did you see the LandingGap?

If you can post a sample multileader, maybe I, or someone else, has a different approach.

 

Henrique

EESignature

Message 4 of 8
ajohnson
in reply to: hmsilva


Not quite right.
Before:
ScreenShot033.jpgAfter:ScreenShot034.jpg

Message 5 of 8
ajohnson
in reply to: hmsilva

In the Properties dialog, the DogLegLength is called Landing Distance....

Getting negative Landing Gaps is not an issue (at the moment)

Message 6 of 8
hmsilva
in reply to: ajohnson

ajohnson.
when I wrote:


...If you can post a sample multileader...

 

I meant, a dwg, a mleader with landing distance set to a negative value, and one correct mleader,
so it would be possible to see the difference between the dxf codes and try to correct the mleader ...

 

Vla_Object.jpg

And by the way, I was talking about properties from a vla-object ...

 

Henrique

EESignature

Message 7 of 8
ajohnson
in reply to: hmsilva

The code above does fix the negative landing distance, however the text still jumps (sometimes) when the landing distance changes.

 

An interesting fact I discovered though, when using Ctrl-C to cut and paste the multileader with a negative landing distance into a new dwg file, the landing distance changes from a negative value to a positive value.

Also, you can't use the Properties Dialog to set a negative value to the landing distance.

So I did a DXFOUT to create the attached dxf file, which seemed to preserve the negative landing distance, though the line spacing of the text gets messed up.

 

Plus, note the vla properties do not have a text insertion point for multileaders, probably due to the complication involved with annotative dimensioning, even if the multileader is not annotative.

 

This might be a bug in the AutoCAD software, but I'm not sure how to create a multileader with a negative landing distance, but they do appear when we open drawings.  I suspect it occurs when the multileader is formatted during layout and something in the leader vertex list doesn't fit with the text postitioning that AutoCAD changes the landing distance to a negative value. But I can't figure it out.

Message 8 of 8
hmsilva
in reply to: ajohnson

ajohnson,

the dxf file you attached, had no negative landing distance, however I changed the dogleglength with entmod, and the text insertion point was not changed, but, the line space factor was changed to 1.

I tried to change also with entmode to the previous value (2), but the value is not accepted, remains 1...

I tried to change the line space factor, also with vla-put-TextLineSpacingFactor, accepts the value but change the text insetion point...

 

Therefore, no success.

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost