Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: help - Polyline vertex number to mtext

  1. #11
    Member
    Join Date
    2023-01
    Posts
    8
    Login to Give a bone
    0

    Default Re: help - Polyline vertex number to mtext

    Hi Ed jobe. I did't ask for a code like this

    I ask for a lisp to 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 1 = sq.m. (and write the area if it is possible and insert mtext in paper ot model space)

    1) select a close polyline.
    2) Pick the first point
    3) insert all point numbers to mtext like the *dwg
    4) Give an option to insert text in [model space or paper space]. For model space ask the text height , for paper scase the text height 2.5

    Thanks
    Last edited by topgunmanerick803304; 2023-01-13 at 04:52 PM.

  2. #12
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: help - Polyline vertex number to mtext

    Hi,
    Give this a go and let me know.

    Code:
    (defun c:Test (/ int sel lwp spc ent ins pts lst rtn hgt str )
      ;;----------------------------------------------------;;
      ;;	Author : Tharwat Al Choufi			;;
      ;; website: https://autolispprograms.wordpress.com	;;
      ;;----------------------------------------------------;;
      (and
        (or (tblsearch "BLOCK" "Point")
            (alert "Attributed Block Name < Point > was not found !")
        )
        (setq spc (getvar 'CTAB))
        (or
          (setq int -1
                sel (ssget "_X"
                           (list '(0 . "INSERT")
                                 '(66 . 1)
                                 '(2 . "point")
                                 (cons 410 spc)
                           )
                    )
          )
          (alert
            (strcat
              "No Attributed Block Name < Point > was not found inserted in this space < "
              spc
              " > !"
            )
          )
        )
        (princ "\nSelect Polyline to get numbers & area : ")
        (or (setq lwp (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
            (alert "Invalid object or nothing selected. Try again")
        )
        (or (foreach itm (entget (ssname lwp 0))
              (and (= (car itm) 10)
                   (setq pts (cons (append (cdr itm) '(0.0)) pts))
              )
            )
            t
        )
        (or
          (while (setq int (1+ int)
                       ent (ssname sel int)
                 )
            (setq ins (cdr (assoc 10 (entget ent))))
            (vl-some
              '(lambda (q)
                 (and
                   (equal q ins 1e-2)
                   (vl-some
                     '(lambda (at)
                        (and
                          (= (vla-get-tagstring at) "POINT")
                          (/= "" (setq rtn (vla-get-textstring at)))
                          (numberp (setq rtn (atoi (vla-get-textstring at)))
                          )
                          (setq lst (cons rtn lst))
                        )
                      )
                     (vlax-invoke
                       (vlax-ename->vla-object ent)
                       'GetAttributes
                     )
                   )
                 )
               )
              pts
            )
          )
          t
        )
        (setq str ""
              lst (vl-sort lst '<)
        )
        (foreach itm lst
          (setq str (strcat str (itoa itm) " - "))
        )
        (setq str (strcat (vl-string-right-trim "- " str)
                          " = "
                          (rtos (vlax-curve-getarea (ssname lwp 0)) 2 2)
                          " sq.m."
                  )
        )
        (or (and (/= spc "Model")
                 (setq hgt 2.5)
            )
            (or (initget 6)
                (setq hgt (getdist "\nSpecify text height : "))
            )
        )
        (setq ins (getpoint "\nSpecify insertion point for Mtext : "))
        (entmake (list '(0 . "MTEXT")
                       '(100 . "AcDbEntity")
                       '(100 . "AcDbMText")
                       (cons 7 (getvar 'TEXTSTYLE))
                       (cons 10 ins)
                       (cons 1 str)
                       (cons 40 hgt)
                 )
        )
      )
      (princ)
    ) (vl-load-com)

  3. #13
    Member
    Join Date
    2023-01
    Posts
    8
    Login to Give a bone
    0

    Default Re: help - Polyline vertex number to mtext

    Hi Tharwat. I try the code but need some updates.

    1) All the points must have numbers

    2)The numbers will be random (Is not all the time the point numbers 1-2-3-4 .... some times must be 30-22-25-42-85-92-... (radom) or K1-K3-D3-G5-45-1-38-.... etc)

    3)Pick the first point and then start clockwise to write the numbers (Is not every time the start of the polyline the start of the numbers)

    4)The first and the last number in the text must be the same example 1 - 2 - 3 - 4 - 5 - 6 - 1
    with space before and after - , " - " , and at the end - sq.m (If it possible calculate the area) <--- Ok

    5) All the polylines must be close.

    6) Give an option to insert text in [model space or paper space]. For model space ask the text height , for paper space the text height 2.5. (The polyline will be in model space but the mtext place to layout)

    7) Must be mtext not simple text <--- OK is Mtext

    8 ) If it possible to suport more than one name of block , some block names is (Point,Dianomi,Ktir,DAS,KOROT,KOKAEK,APAL,NAPAL). Sometimes on the same polyline will me 2 or 3 of them.



    Thanks
    Attached Files Attached Files
    Last edited by topgunmanerick803304; 2023-01-14 at 07:22 AM.

  4. #14
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: help - Polyline vertex number to mtext

    The codes that I posted does job you have explained earlier.

    My program does not number the vertices in incrementing order starts from 1 to the end but it does collect the numbers from the attributed blocks 'point' which located on selected polyline's vertices which means you have no idea what the code does.

    You are now coming up with more new additions that are not mentioned earlier and 'ordering' me to do them for you.! Anyway what you are 'demanding' can't be done for free so you can message me to write the full version for you or for your 'customer' based on the fees that we will agree on in prior of writing any code.

  5. #15
    Member
    Join Date
    2023-01
    Posts
    8
    Login to Give a bone
    0

    Default Re: help - Polyline vertex number to mtext

    Hi Tharwat, you said

    You are now coming up with more new additions that are not mentioned earlier
    Look post #1. I am not coming up with nothing new. I said to pick the first point.To have the option from what number starts the counting. If the numbers are 1 -3 - 2 - 5 - 4 your code export a text 1-2-3-4-5 <---This is not correct. Don't read correct the order of the point numbers, even with random start point.

    Hi, I need some help. I am searching for a lisp to :

    1) select a close polyline.
    2) Pick the first point
    3) insert all point numbers to mtext like the *dwg
    4) Give an option to insert text in [model space or paper space]. For model space ask the text height , for paper scase the text height 2.5



    Thanks

    I thank you for your time but don't blame for the code mistakes . You said

    Give this a go and let me know.
    And I let you know.

    Thanks
    Attached Files Attached Files

  6. #16
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: help - Polyline vertex number to mtext

    Quote Originally Posted by topgunmanerick803304 View Post
    Hi Ed jobe. I did't ask for a code like this
    I know its not what you asked for. I told you that I can't do it now. What I gave you CAN make it easier to number vertices. It's better that what you had, which is nothing. Don't forget to be polite.
    C:> ED WORKING....

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 0
    Last Post: 2017-05-01, 11:00 AM
  2. Vertex X and Vertex Y for Leader
    By ismail.asi.160407 in forum AutoCAD Fields
    Replies: 4
    Last Post: 2010-05-17, 09:36 AM
  3. Adding vertex to polyline
    By georgen in forum AutoCAD General
    Replies: 3
    Last Post: 2008-12-12, 03:13 PM
  4. Adding a vertex to a polyline
    By cadconcepts in forum AutoLISP
    Replies: 1
    Last Post: 2007-11-06, 11:13 PM
  5. Polyline add/remove vertex right click options
    By steve.howatt in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2004-08-24, 02:18 PM

Posting Permissions

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