See the top rated post in this thread. Click here

Results 1 to 6 of 6

Thread: Offset Groups of Text

  1. #1
    100 Club
    Join Date
    2015-11
    Location
    Cincinnati, Ohio
    Posts
    173
    Login to Give a bone
    0

    Default Offset Groups of Text

    I made a video explaining my question. I am leaving a drop box link below.

    https://www.dropbox.com/s/20xowahjy3...stion.mp4?dl=0

  2. #2
    Active Member
    Join Date
    2015-12
    Location
    Western Europe
    Posts
    57
    Login to Give a bone
    0

    Default Re: Offset Groups of Text

    The first option is a bit of a stretch, but the second option should be possible. Post an example drawing saved as AutoCAD 2012 or earlier. I can't look at it until Thursday however.

  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
    1

    Default Re: Offset Groups of Text

    OK Here is a function that works for your purposes.

    It has a lot of room to be enhanced.

    Select the text to move and select the last piece of text above it for alignment.

    The complexity comes from finding the insertion point of the top of group of text, various sorting steps need to happen

    Then it is relatively straight forward.

    (This post and attachments has been revised)

    P=

    Code:
    ;___________________________________________________________________________________________________________|
    ;
    ; Written By: Peter Jamtgaard C.E., P.E., S.E. copyright 2020 All Rights Reserved
    ;___________________________________________________________________________________________________________|
    ;
    ; Any use by unauthorized person or business is strictly prohibited.
    ;___________________________________________________________________________________________________________|
    ;
    ; Command Line Function Header List
    ;___________________________________________________________________________________________
    
    ;  Function and Description
    
    ;* C:OQ
    ;* C:OffsetQuestion
    ;* Command Line Function to move selected group of text under another selected text
    
    ;___________________________________________________________________________________________________________|
    ;
    ; General Function Header List 
    ;___________________________________________________________________________________________________________|
    
    ;* (ListofSublistsSortbyAnItem lstOfSublists intItem)
    ;*  Function to sort list of sublists by item
    
    ;* (ObjectInsertionPointSublist objText)
    ;* Function to create a sublist of x,y,z coordinates, height and vla-object of a vla-object
    
    ;* (SelectionSetToListOfObjects ssSelections)
    ;* Function to convert selection set into list of vla-objects
    
    ;* (TopLineOfTextInsertionPoint ssSelections)
    ;* Function to get insertion point of top line of Text
    
    ;$ Header End
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Command Line Function to move selected group of text under another selected text
    ;___________________________________________________________________________________________________________|
    
    (defun C:OQ ()(C:OffsetQuestion))
    (defun C:OffsetQuestion (/  lstInsertion1 lstInsertion2 lstObject1 lstObjects objSelection 
                                sngHeight ssSelection1 ssSelections)
     (if (and (princ "\nSelect Text To Move: ")
              (setq ssSelections      (ssget (list (cons 0 "text"))))
              (setq lstObjects        (SelectionSetToListOfObjects ssSelections))
              (princ "\nSelect Text for Alignment: ")
              (setq ssSelection1      (ssget ":S:E" (list (cons 0 "text"))))
              (setq lstObject1        (SelectionSetToListOfObjects ssSelection1))
              (setq objSelection      (car lstObject1))
              (setq lstInsertion1     (vlax-get objSelection "insertionPoint"))
              (setq sngHeight         (vlax-get objSelection "height"))
              (setq lstInsertion1     (mapcar '+ (list 0.0 (* -3.213 sngHeight) 0.0) lstInsertion1)); For Romans.shx
              (prinx 'lstInsertion1)
              (setq lstInsertion2     (TopLineOfTextInsertionPoint ssSelections))
              (prinx 'lstInsertion2)
         )
      (vl-cmdf "move" ssSelections "" lstInsertion2 lstInsertion1)
     )
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to sort list of sublists by item
    ;___________________________________________________________________________________________________________|
    
    (defun ListofSublistsSortbyAnItem (lstOfSublists intItem)
     (vl-sort lstOfSublists '(lambda (X Y) (< (nth intItem X) (nth intItem Y))))
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to create a sublist of x,y,z coordinates, height and vla-object of a vla-object
    ;___________________________________________________________________________________________________________|
    
    (defun ObjectInsertionPointSublist (objText)
     (append (list objText)
             (vlax-get objText "insertionpoint")
     )
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to convert selection set into list of vla-objects
    ;___________________________________________________________________________________________________________|
    
    (defun SelectionSetToListOfObjects (ssSelections /  entSelection intCount lstObjects objSelection)
     (repeat (setq intCount (sslength ssSelections))
      (and
       (setq intCount     (1- intCount))
       (setq entSelection (ssname ssSelections intCount))
       (setq objSelection (vlax-ename->vla-object entSelection))
       (setq lstObjects   (cons objSelection lstObjects))
      )
     )
     lstObjects
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to get insertion point of top left of Text
    ;___________________________________________________________________________________________________________|
    
    (defun TopLineOfTextInsertionPoint (ssSelections / lstObjects lstOfObjects 
                                        lstCoordinatesX lstCoordinatesY lstCoordinateX lstCoordinateY )
     (if (and (setq lstObjects    (SelectionSetToListOfObjects ssSelections))
              (setq lstOfSublists (mapcar 'ObjectInsertionPointSublist lstObjects))
              (setq lstCoordinatesX (mapcar 'cadr lstOfSublists))
              (setq lstCoordinatesY (mapcar 'caddr lstOfSublists))
              (setq sngCoordinateX  (apply 'min lstCoordinatesX))
              (setq sngCoordinateY  (apply 'max lstCoordinatesY))
         )
      (list sngCoordinateX sngCoordinateY 0.0)
     )
    )
    
    
    (vl-load-com)
    Attached Files Attached Files
    Last edited by peter; 2020-12-09 at 04:33 PM.
    AutomateCAD

  4. #4
    100 Club
    Join Date
    2015-11
    Location
    Cincinnati, Ohio
    Posts
    173
    Login to Give a bone
    0

    Default Re: Offset Groups of Text

    thank you peter and dlanor for responding. I think the lisp you sent needs text to have a specific justification or something to work correctly. here is a link for a video question

    https://www.dropbox.com/s/zlptnbqzyc...wrong.mp4?dl=0

    Also I am using autocad 2018, not sure if this matters

    I think the way the schedule is set up it will be imposable to get a lisp routine to work. my apologies
    Attached Files Attached Files

  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
    1

    Default Re: Offset Groups of Text

    I assumed the text in each line was one piece of text left justified.

    It helps to see the full drawing file.

    I have made a couple tweeks and it works on the sample file for me.

    (I revised the other post and attachment)

    The key is finding the upper left insertion point of text in the selection set.

    Once you have that it is easy.

    P=
    Last edited by peter; 2020-12-09 at 04:37 PM.
    AutomateCAD

  6. #6
    100 Club
    Join Date
    2015-11
    Location
    Cincinnati, Ohio
    Posts
    173
    Login to Give a bone
    0

    Default Re: Offset Groups of Text

    Thank you peter,,,I really appreciate the help!

Similar Threads

  1. Save detail groups as component/symbol and model groups as family
    By Wish List System in forum Revit Structure - Wish List
    Replies: 0
    Last Post: 2012-09-11, 01:13 PM
  2. Survey Figure Groups concept identical to Point Groups.
    By Wish List System in forum Civil 3D Wish List
    Replies: 0
    Last Post: 2011-11-16, 09:24 PM
  3. Crashes through Section View Groups and Sample Line Groups
    By WScottAllenPE in forum AutoCAD Civil 3D - Sections
    Replies: 3
    Last Post: 2010-09-09, 11:08 AM
  4. Groups? Nested Groups?
    By sknudsen in forum Revit Architecture - General
    Replies: 9
    Last Post: 2006-08-01, 07:19 AM
  5. GROUPS - Shared with groups schedule fields problem
    By robmorfin in forum Revit Architecture - General
    Replies: 2
    Last Post: 2005-09-10, 01:01 AM

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
  •