Jump to content
Costinbos77

Define a MLeader Style in AutoCAD Map 2021 french version

Recommended Posts

Costinbos77

Hi ,

if :

(setq MLeaderStyles (vla-item (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))

_$ (vlax-dump-object MLeaderStyles T)
; IAcadDictionary: Un objet incorporant de stockage et de récupération des objets
; Valeurs de propriétés:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff622d6b910>
;   Count (RO) = 1
;   Document (RO) = #<VLA-OBJECT IAcadDocument 00000171d1d23398>
;   Handle (RO) = "D7"
;   HasExtensionDictionary (RO) = 0
;   Name = "ACAD_MLEADERSTYLE"
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AcDbDictionary"
;   OwnerID (RO) = 43
; Méthodes prises en charge:
;   AddObject (2)
;   AddXRecord (1)
;   Delete ()
;   GetExtensionDictionary ()
;   GetName (1)
;   GetObject (1)
;   GetXData (3)
;   Item (1)
;   Remove (1)
;   Rename (2)
;   Replace (2)
;   SetXData (2)
T
_$ (setq ml0 (vla-Item MLeaderStyles 0))
#<VLA-OBJECT IAcadMLeaderStyle 00000171cf866968>
_$ (vlax-dump-object ml0 T)
; IAcadMLeaderStyle: Interface du style de ligne de repère multiple d'AutoCAD
; Valeurs de propriétés:
;   AlignSpace = 0.18
;   Annotative = 0
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff622d6b910>
;   ArrowSize = 0.18
;   ArrowSymbol = ""
;   BitFlags = 0
;   Block = ""
;   BlockColor = #<VLA-OBJECT IAcadAcCmColor 00000171910057d0>
;   BlockConnectionType = 0
;   BlockRotation = 0.0
;   BlockScale = 1.0
;   BreakSize = 0.125
;   ContentType = 2
;   Description = "Standard"
;   Document (RO) = #<VLA-OBJECT IAcadDocument 00000171d1d23398>
;   DoglegLength = 0.36
;   DrawLeaderOrderType = 0
;   DrawMLeaderOrderType = 1
;   EnableBlockRotation = -1
;   EnableBlockScale = -1
;   EnableDogleg = -1
;   EnableFrameText = 0
;   EnableLanding = -1
;   FirstSegmentAngleConstraint = 0
;   Handle (RO) = "D8"
;   HasExtensionDictionary (RO) = 0
;   LandingGap = 0.09
;   LeaderLineColor = #<VLA-OBJECT IAcadAcCmColor 0000017191005230>
;   LeaderLinetype = 1
;   LeaderLineTypeId = "ByBlock"
;   LeaderLineWeight = -2
;   MaxLeaderSegmentsPoints = 2
;   Name = "Standard"
;   ObjectID (RO) = 44
;   ObjectName (RO) = "AcDbMLeaderStyle"
;   OverwritePropChanged (RO) = 0
;   OwnerID (RO) = 42
;   ScaleFactor = 1.0
;   SecondSegmentAngleConstraint = 0
;   TextAlignmentType = 0
;   TextAngleType = 1
;   TextAttachmentDirection = 0
;   TextBottomAttachmentType = 0
;   TextColor = #<VLA-OBJECT IAcadAcCmColor 0000017191006130>
;   TextHeight = 0.18
;   TextLeftAttachmentType = 1
;   TextRightAttachmentType = 1
;   TextString = ""
;   TextStyle = "Standard"
;   TextTopAttachmentType = 0
; Méthodes prises en charge:
;   Delete ()
;   GetExtensionDictionary ()
;   GetXData (3)
;   SetXData (2)
T

 

why the next code is not working in AutoCAD Map 2021 french version and Windows 10 ?

(setq NewMLeaderStyle (vla-AddObject MLeaderStyles "NewName" "AcDbMLeaderStyle"))

; erreur: Erreur Automation Entrée AcRxClassName ne se trouve pas dans le registre du système

in En :
; Error: Automation Error AcRxClassName entry not found in the system registry

 

"AcDbMLeaderStyle" is diffrent in AutoCAD Map 2021 ? was working in AutoCAD Map 2011 .

 

 

Regards ,

 

Costin

Edited by Costinbos77

Share this post


Link to post
Share on other sites
pkenewell

Try using this instead to get your Mleaderstyle collection:

 

(setq mleaderstyles
   (vlax-ename->vla-object
      (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE")))
   )
)

 

Otherwise I don't know why it would not work.

 

Edited by pkenewell

Share this post


Link to post
Share on other sites
Costinbos77

Hi pkenewell ,

 

your expresion it is for 'MLeaderStyles' collection and it is working , is not working to add a New MLeader Style .

 

In your AutoCAD Mechanical 2016 , my codes are working fine ?

(setq MLeaderStyles (vla-item (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))
;#<VLA-OBJECT IAcadDictionary 000000003c72e548>

(setq NewMLeaderStyle (vla-AddObject MLeaderStyles "NewName" "AcDbMLeaderStyle"))
;#<VLA-OBJECT IAcadMLeaderStyle 000000003c1e17e8>

 

Regards ,

 

Costin

Edited by Costinbos77

Share this post


Link to post
Share on other sites
ronjonp

Your code above works in Vanilla AutoCAD 2021.

Share this post


Link to post
Share on other sites
Costinbos77

Thanks ronjonp ,

 

so , it is something diffrent with AutoCAD Map 2021 .

Share this post


Link to post
Share on other sites
pkenewell
30 minutes ago, Costinbos77 said:

Hi pkenewell ,

 

your expresion it is for 'MLeaderStyles' collection and it is working , is not working to add a New MLeader Style .

 

In your AutoCAD Mechanical 2016 , my codes are working fine ?


(setq MLeaderStyles (vla-item (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))
;#<VLA-OBJECT IAcadDictionary 000000003c72e548>

(setq NewMLeaderStyle (vla-AddObject MLeaderStyles "NewName" "AcDbMLeaderStyle"))
;#<VLA-OBJECT IAcadMLeaderStyle 000000003c1e17e8>

 

Regards ,

 

Costin

 

@Costinbos77 yeah I was reaching for straws. Thought in might be in how the collection object was obtained - I'm stumped otherwise - no way to test as I don't have Map, let alone the french version.

 

I need to update my profile LOL - I am currently using Vanilla 2020!

Edited by pkenewell

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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