See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Merge Text Styles ie LAYMRG but for text styles

  1. #1
    Login to Give a bone
    0

    Default Merge Text Styles ie LAYMRG but for text styles

    Merge Text Styles ie LAYMRG but for text styles

    I need a command line LISP that will act like
    Code:
     (if (Tblsearch "LAYER" "A-Wall-Low")
       (command "._LAYMRG" "N" "A-Wall-Low" "" "N" "ARPARTITIONlow" "Y") 
     )
    But for text styles
    The only think I found that was close but I cant see to figure out is

    I have been looking and could really use your help
    Last edited by BlackBox; 2015-02-20 at 03:01 PM. Reason: Please use [CODE] Tags

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    Opps! Replied to wrong post.

    Here's a really nice dialog box routine that lets you select which text styles in the drawing you wish to merge from one column and select the style you want to merge to in another. Includes option to delete style(s) after merge and create styles as well. In my top twenty list of lisp downloads. Loaded slow the first time I used it, popped up instantly ever since.
    http://www.theswamp.org/index.php?topic=17659.0;all

  3. #3
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    Half the fun of hanging out at the programming forums, is I can sharpen my programming skills while helping others.

    Even if someone has already written the routine, it is fun to try to code it.

    Sometimes I need to go look at what others have done, but then I give credit, modify the other code to my standards and write the routine.

    I also wanted to mention that it is my opinion that every line of code should be self explanatory.

    when someone uses a single character variable or lots of single character variables it is hard to read.

    I also use the and syntax and try to make all of my code return T (or value) if successful and nil if it fails.

    I also make my function names descriptive so it is easy to understand what they do.

    (Noun first Verb second) in function names.

    I would be interested in how many of you lurkers have difficulty reading my code samples?

    Please let me know if you would like explanations.

    I think you can learn to read my code quickly and take your programming skills to the next level.

    Anyway the stylemerge routine below.

    P=


    Code:
    ;___________________________________________________________________________________________________________
    ;
    ; Command line Function merge text style collection objects.
    ; Remember it will not delete a text style if it is a part of a dimstyle or is specified in a system variable...
    ; Written By: Peter Jamtgaard copyright 2015
    ;___________________________________________________________________________________________________________
    
    (defun C:StyleMerge (/ strStyleOld strStyleNew)
     (setq strStyleOld (getstring "\nEnter Old Style Name: ")
           strStyleNew (getstring "\nEnter New Style Name: ")
     )
     (stylemerge strStyleOld strStyleNew)
    )
    
    ;___________________________________________________________________________________________________________
    ;
    ; Function to merge text styles
    ;___________________________________________________________________________________________________________
    
    
    (defun stylemerge (strStyleOld strStyleNew / entItem objItem objBlock)
     (vlax-for objBlock (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
      (and
       (> (vla-get-count objBlock) 0)
       (setq objItem (vla-item objBlock 0))
       (setq entItem (vlax-vla-object->ename objItem))
       (while entItem
        (setq objItem (vlax-ename->vla-object entItem)) 
        (if (= (strcase strStyleOld)(strcase (vla-get-Stylename objItem)))
         (vla-put-Stylename objItem strStyleNew)
        )
        (setq entItem (entnext entItem))
       )
      )
     )
     (if (setq objStyle (styledefinition strStyleOld))
      (errortrap (quote (vla-delete objStyle)))
     )
    )
    
    
    ;___________________________________________________________________________________________________________
    ;
    ; Function to to get text style object from string name
    ;___________________________________________________________________________________________________________
    
    (defun StyleDefinition (strStyle)
     (vla-item (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object))) strStyle)
    )
    
    (defun TextStyleDefinition (objText)
     (vla-item (vla-get-textstyles
                (vla-get-document objText))
      (vla-get-stylename objText)
     )
    )
    
    ;___________________________________________________________________________________________________________
    ;
    ; Standard Error trap function 
    ;___________________________________________________________________________________________________________
    
    
    (defun ErrorTrap (symFunction / objError result)
     (if (vl-catch-all-error-p
          (setq objError (vl-catch-all-apply
                         '(lambda (X123)(set X123 (eval symFunction)))
                          (list 'result))))
      nil
      (if result result 'T)
     )
    )
    
    
    
    (vl-load-com)
    Attached Files Attached Files
    AutomateCAD

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    I wish someone would come up with one to handle textstyle references in C3D styles.

    LayMrg sort of works for layers. It somewhat "corrupts" the style by setting the deleted layer to a null entry, but an AUDIT will fix those by setting them to layer 0.
    R.K. McSwain | CAD Panacea |

  5. #5
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    Can you post a vlax-dump-object of a civil 3d style?

    I do not have civil 3d loaded on my computer.

    P=
    AutomateCAD

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    Quote Originally Posted by peter View Post
    Can you post a vlax-dump-object of a civil 3d style?
    Hmmmm... must be stored in a child object or XDATA?
    I'll look later, but for now...

    Code:
    ; IAeccLabelStyle: IAeccLabelStyle Interface
    ; Property values:
    ;   Application (RO) = #<VLA-OBJECT IAeccApplication 0000000033d975b0>
    ;   BlockComponents (RO) = #<VLA-OBJECT IAeccLabelStyleBlockComponents 0000000038f7eda0>
    ;   Children (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000038bfe108>
    ;   CreatedBy = "Autodesk"
    ;   DateCreated (RO) = "2/24/2006 12:26:49 AM"
    ;   DateModified (RO) = "3/6/2013 11:07:33 AM"
    ;   Descendants (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000038bf8708>
    ;   Description = "Existing contour labels"
    ;   DirectionArrowComponents (RO) = #<VLA-OBJECT IAeccLabelStyleDirectionArrowComponents 0000000038f774b0>
    ;   Document (RO) = #<VLA-OBJECT IAeccDocument 0000000038f7ca60>
    ;   DraggedComponentStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedComponentStyle 0000000038f7c880>
    ;   DraggedLeaderStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedLeaderStyle 0000000038f78260>
    ;   Handle (RO) = "A78F"
    ;   HasExtensionDictionary (RO) = 0
    ;   LabelProperties (RO) = #<VLA-OBJECT IAeccLabelStyleProperties 0000000038f7cac0>
    ;   LineComponents (RO) = #<VLA-OBJECT IAeccLabelStyleLineComponents 0000000038f782c0>
    ;   ModifiedBy (RO) = "xxxxxx"
    ;   Name = "Existing Contours Labels"
    ;   ObjectID (RO) = 44
    ;   ObjectName (RO) = "AeccDbLabelStyleCollector"
    ;   OwnerID (RO) = 45
    ;   Parent (RO) = #<VLA-OBJECT IAeccLabelStyle 000000003a043ab0>
    ;   TextComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTextComponents 0000000038f7e2c0>
    ;   TickComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTickComponents 0000000038f75ce0>
    ;   Type (RO) = 11
    ; Methods supported:
    ;   Delete ()
    ;   ExportTo (2)
    ;   GetExtensionDictionary ()
    ;   GetXData (3)
    ;   RemoveOverrides ()
    ;   SetXData (2)
    R.K. McSwain | CAD Panacea |

  7. #7
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    Can you do a dump on this property?

    TextComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTextComponents 0000000038f7e2c0>
    AutomateCAD

  8. #8
    Member
    Join Date
    2013-08
    Posts
    23
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    Quote Originally Posted by peter View Post
    Can you do a dump on this property?

    TextComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTextComponents 0000000038f7e2c0>
    Code:
    Command: (vlax-dump-object bb)
    ; IAeccLabelStyle: IAeccLabelStyle Interface
    ; Property values:
    ;   Application (RO) = #<VLA-OBJECT IAeccApplication 0000000079f80550>
    ;   BlockComponents (RO) = #<VLA-OBJECT IAeccLabelStyleBlockComponents 000000006f7998b0>
    ;   Children (RO) = #<VLA-OBJECT IAeccLabelStyles 000000006f9fdd38>
    ;   CreatedBy = "RRM"
    ;   DateCreated (RO) = "8/28/2004 8:04:10 AM"
    ;   DateModified (RO) = "3/21/2008 8:09:00 AM"
    ;   Descendants (RO) = #<VLA-OBJECT IAeccLabelStyles 000000006fa00138>
    ;   Description = "Style for finished ground profiles."
    ;   DirectionArrowComponents (RO) = #<VLA-OBJECT IAeccLabelStyleDirectionArrowComponents 000000006f799280>
    ;   Document (RO) = #<VLA-OBJECT IAeccDocument 000000006f79f5e0>
    ;   DraggedComponentStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedComponentStyle 000000006f79df90>
    ;   DraggedLeaderStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedLeaderStyle 0000000079f87930>
    ;   Handle (RO) = "1301"
    ;   HasExtensionDictionary (RO) = 0
    ;   LabelProperties (RO) = #<VLA-OBJECT IAeccLabelStyleProperties 0000000079f839a0>
    ;   LineComponents (RO) = #<VLA-OBJECT IAeccLabelStyleLineComponents 0000000079f84450>
    ;   ModifiedBy (RO) = "sjbrown"
    ;   Name = "_RRM Finished Ground Labels"
    ;   ObjectID (RO) = 44
    ;   ObjectName (RO) = "AeccDbLabelStyleCollector"
    ;   OwnerID (RO) = 45
    ;   Parent (RO) = #<VLA-OBJECT IAeccLabelStyle 0000000070fdac70>
    ;   TextComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTextComponents 0000000079f7bf60>
    ;   TickComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTickComponents 0000000079f85bc0>
    ;   Type (RO) = Exception occurred
    T
    Command: (setq cc (vlax-get-property bb 'textcomponents))
    #<VLA-OBJECT IAeccLabelStyleTextComponents 0000000079f826e0>
    Command: (vlax-dump-object cc)
    ; IAeccLabelStyleTextComponents: IAeccLabelStyleTextComponents Interface
    ; Property values:
    ;   Count (RO) = 1
    ;   Item (RO) = ...Indexed contents not shown...
    ;   _NewEnum (RO) = #<IUnknown 000000006f475cf0>
    T

    it doesn't reveal much.

  9. #9
    Woo! Hoo! my 1st post
    Join Date
    2015-01
    Posts
    1
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    command -STYLE

    Enter name of text style you want changed
    Enter name of text style to change it to

  10. #10
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Merge Text Styles ie LAYMRG but for text styles

    Quote Originally Posted by peter View Post
    Can you do a dump on this property?

    TextComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTextComponents 0000000038f7e2c0>
    Okay, actually its buried under LabelProperties (RO) = #<VLA-OBJECT IAeccLabelStyleProperties 0000000038f7cac0>

    Code:
    _$ 
    
    ; IAeccLabelStyleProperties: IAeccLabelStyleProperties Interface
    ; Property values:
    ;   ForcedInsertion (RO) = #<VLA-OBJECT IAeccPropertyEnumForcedInsertion 000000003ba79740>
    ;   ForceInsideCurve (RO) = #<VLA-OBJECT IAeccPropertyBoolean 000000003ba791a0>
    ;   Layer (RO) = #<VLA-OBJECT IAeccPropertyLayer 000000003ba80310>
    ;   OrientationReference (RO) = #<VLA-OBJECT IAeccPropertyEnumOrientationReference 000000003ba7a2e0>
    ;   PlanReadable (RO) = #<VLA-OBJECT IAeccPropertyBoolean 000000003ba7a130>
    ;   PlanReadableBias (RO) = #<VLA-OBJECT IAeccPropertyDouble 000000003ba796e0>
    ;   PlanReadableFlipAnchors (RO) = #<VLA-OBJECT IAeccPropertyBoolean 000000003ba80880>
    ;   TagDisplayMode (RO) = #<VLA-OBJECT IAeccPropertyBoolean 000000003ba7a6d0>
    ;   TextStyle (RO) = #<VLA-OBJECT IAeccPropertyTextStyle 000000003ba79890>
    ;   Visibility (RO) = #<VLA-OBJECT IAeccPropertyBoolean 000000003ba7fd40>
    ; No methods
    ...and then from there, TextStyle (RO) = #<VLA-OBJECT IAeccPropertyTextStyle 000000003ba79890>

    Code:
    _$ 
    
    ; IAeccPropertyTextStyle: IAeccPropertyTextStyle Interface
    ; Property values:
    ;   Locked = 0
    ;   Overridden = 0
    ;   Overrideable (RO) = -1
    ;   ReadOnly (RO) = 0
    ;   Value = "SIMPLEX"
    ; No methods
    R.K. McSwain | CAD Panacea |

Page 1 of 2 12 LastLast

Similar Threads

  1. Merge Text Styles to a Selected Text Style
    By Wish List System in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-05-16, 01:58 PM
  2. VBA.NET Routine to Merge Text Styles
    By chillme1 in forum Dot Net API
    Replies: 6
    Last Post: 2011-02-24, 11:27 AM
  3. Sharing standard Dimension styles, text styles, hatch patterns, etc
    By dhavalpatel_us337373 in forum AutoCAD General
    Replies: 1
    Last Post: 2007-02-02, 08:34 PM
  4. Merge Text Styles
    By BCrouse in forum AutoLISP
    Replies: 7
    Last Post: 2005-04-26, 10:05 PM
  5. Link Text with Object Styles & Line Styles
    By Chad Smith in forum Revit Architecture - Wish List
    Replies: 4
    Last Post: 2004-07-15, 04:27 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •