Author Topic: MLEADER style  (Read 4274 times)

0 Members and 1 Guest are viewing this topic.

seejay

  • Guest
MLEADER style
« on: July 06, 2007, 12:19:44 PM »
AC 2008

I've made a routine to create new MLEADER styles but I am having some problems. The routine creates them but when the drawing is saved, closed and reopend, AutoCAD reports an error. An AUDIT will correct the problem but remove the style my routine created. It doesn't seem to have a problem if saved to the 2007 format but we have to save to 2004 right now as we are currently mixed 2005 and 2008. I'm trying to use ActiveX as this is tied to an AutoLayer system using reactors.

Anyone have a better way or see the flaw in my method?

thanks

CJ



Code: [Select]
(setq mleadername ("HC001")
(if (not (vl-position mleadername (cjf:getkeys "ACAD_MLEADERSTYLE")))
 (progn
   (setq mldrdict (vla-item (vla-get-dictionaries *AcadDoc*)
"ACAD_MLEADERSTYLE"))
   (setq newldrstyle (vlax-invoke mldrdict 'addobject mleadername
"AcDbMLeaderStyle"))
   (vlax-put newldrstyle 'AlignSpace 0.18)
   (vlax-put newldrstyle 'Annotative 0)
   (vlax-put newldrstyle 'ArrowSize 0.0625)
   (vlax-put newldrstyle 'ArrowSymbol "dimarrow");;<---
   (vlax-put newldrstyle 'BitFlags 0)
   (vlax-put newldrstyle 'BlockConnectionType 0)
   (vlax-put newldrstyle 'BlockRotation 0.0)
   (vlax-put newldrstyle 'BlockScale 1.0)
   (vlax-put newldrstyle 'BreakSize 0.0625)
   (vlax-put newldrstyle 'ContentType 2)
   (vlax-put newldrstyle 'Description "Standard")
   (vlax-put newldrstyle 'DoglegLength 0.0625)
   (vlax-put newldrstyle 'DrawLeaderOrderType 0)
   (vlax-put newldrstyle 'DrawMLeaderOrderType 1)
   (vlax-put newldrstyle 'EnableBlockRotation -1)
   (vlax-put newldrstyle 'EnableBlockScale -1)
   (vlax-put newldrstyle 'EnableDogleg -1)
   (vlax-put newldrstyle 'EnableFrameText 0)
   (vlax-put newldrstyle 'EnableLanding -1)
   (vlax-put newldrstyle 'FirstSegmentAngleConstraint 0)
   (vlax-put newldrstyle 'LandingGap 0.0625)
   (vlax-put newldrstyle 'LeaderLineType 1)
   (vlax-put newldrstyle 'LeaderLineTypeId "ByBlock")
   (vlax-put newldrstyle 'LeaderLineWeight -2)
   (vlax-put newldrstyle 'MaxLeaderSegmentsPoints 2)
   (vlax-put newldrstyle 'ScaleFactor (getvar "dimscale"));;;<-----
   (vlax-put newldrstyle 'SecondSegmentAngleConstraint 0)
   (vlax-put newldrstyle 'TextAlignmentType 0)
   (vlax-put newldrstyle 'TextAngleType 1)
   (vlax-put newldrstyle 'TextHeight 0.09375);<---
   (vlax-put newldrstyle 'TextLeftAttachmentType 1)
   (vlax-put newldrstyle 'TextRightAttachmentType 1)
   (vlax-put newldrstyle 'TextString "")
   (vlax-put newldrstyle 'TextStyle textstyle);;<-
    )
 )

(vla-setvariable *AcadDoc* "CMLEADERSTYLE" mleadername)






(defun cjf:getKeys (dictName / tmp)
  (if (setq tmp (cjf:getDict dictName))
    (cjf:massoc 3 tmp)
    )
  )

(defun cjf:massoc (key alist / x nlist)
  (foreach x alist
    (if (eq key (car x))
      (setq nlist (cons (cdr x) nlist))
      )
    )
  (reverse nlist)
  )

Maverick®

  • Seagull
  • Posts: 14778
Re: MLEADER style
« Reply #1 on: July 06, 2007, 12:24:03 PM »
  I'm sure someone with more knowledge will come along to answer but I wanted to say Welcome.  And what a great example of a question post!!

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: MLEADER style
« Reply #2 on: July 06, 2007, 12:35:40 PM »
It doesn't seem to have a problem if saved to the 2007 format but we have to save to 2004 right now as we are currently mixed 2005 and 2008. I'm trying to use ActiveX as this is tied to an AutoLayer system using reactors.

Anyone have a better way or see the flaw in my method?

thanks

CJ
Since Mleaders aren't available in 2004 that is more than likely the cause of the problem.....

seejay

  • Guest
Re: MLEADER style
« Reply #3 on: July 06, 2007, 01:29:55 PM »
2004 doesn't have mleaders but if i create a style in the mleader style manager, there isn't a problem. The styles are restored in the round trip. What i have resorted to for now is I load a block with the styles in them when a user opens a file without the styles present. The styles were created using the style manager. Not as efficient or nice as making them programmatically.

thanks

BazzaCAD

  • Guest
Re: MLEADER style
« Reply #4 on: July 06, 2007, 04:43:46 PM »
Yap I have the same prob. with mt MLeader creator.
I never noticed it before because I didn't save to 2004.
I guess creating MLeaders with the dialog adds something else to the dwg that we're missing....

seejay

  • Guest
Re: MLEADER style
« Reply #5 on: July 06, 2007, 04:48:54 PM »
well at least i know it's not just me then. I'll have to use my work around until something better comes along.

thanks.

BazzaCAD

  • Guest
Re: MLEADER style
« Reply #6 on: July 17, 2007, 06:23:17 PM »
Now I'm having anther issue, with the MLeaders.
When I create them in the DWG, and place them they're fine.
But when I save (2007), re-open & place new ones the text height is too big.
When I check the height in the MLeaderStyle, it's set to the correct height, grayed out & Anno. is check.
If I uncheck Anno & recheck it again, then they fix themselves to the correct height...
Strange....

BazzaCAD

  • Guest
Re: MLEADER style
« Reply #7 on: July 17, 2007, 06:34:56 PM »
Never mind, I found my bug.
I wasn't setting the MLeader text height in my creation code, since I figured the Anno saling would take care of it.
And it did right after the styles where created, but for some reason when you re-open the dwg, it doesn't remember those text heights....

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Re: MLEADER style
« Reply #8 on: October 22, 2007, 05:34:28 PM »
Has anyone tried via VBA yet?  just wondering
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

seejay

  • Guest
Re: MLEADER style
« Reply #9 on: October 23, 2007, 05:15:58 PM »
Someone in the LISP customization group over there===> tried and had similar problems.
http://discussion.autodesk.com/thread.jspa?messageID=5652913

from the sound of it in another post, mleaders have not been fully developed as far as lisp and vba go.
Quoting Joe Burke:
Plus this from developer help regarding the mleader object type:

"Any annotation attached to the end of the leader line is associated with the MLeader
object and can be found using the Annotation property."

A Leader object has an Annotation property, but an MLeader does not. The developer
docs are wrong in this case. Not to mention the fact documentation regarding
annotative objects is totally lacking at least from the lisp/vlisp standpoint AFAIK.


hopefully they will resolve this in the next release... <not holding breath>

cj

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: MLEADER style
« Reply #10 on: October 24, 2007, 07:29:55 AM »
I gave up creating stuff a long time ago.  The strategy now is I have a "Standards" drawing with all my styles, layers, blocks, etc. defined in a central location and use ObjectDBX to import as required.  Annotation dynamic block tags, layers, blocks, ADT styles, text and dim styles, etc.  If you'd like to try this route I can help with code. 
James Buzbee
Windows 8