Results 1 to 2 of 2

Thread: unable to mention Text / name to inserted object with Autolisp program

  1. #1
    Active Member
    Join Date
    2008-12
    Location
    JODHPUR/RAJASTHAN/INDIA
    Posts
    66
    Login to Give a bone
    0

    Question unable to mention Text / name to inserted object with Autolisp program

    I have some old autolisp programs with me that insert some parts like bearing/sprockets etc with help of relative text file.

    after inserting multiple parts it is impossible to remember which size/name is that particular part, so I have got an Idea to name that part with Program itslef when it is being inserted with small height text (0.5-height), so it could not interfere entire big assembly when zoomed out and if zoomed in to that part it shows its name, that would also help in making BOM and to refer in future.

    I tried in many ways (till what extent I learned) but the problem is -

    the program is OK if i insert the part in a new drawing, it creates part name at given point with 0.5-height, but when i tried to insert the same in old file which has some text style, higher text height and other properties, it does not worked well and gives part name/text with height of text equal to same height in which the old drawing is having its own properties.


    You can see in Lisp file, I have tried 2~3ways to get it done, i.e. with help of mtext and text also but i believe there is some small thing which i am missing, please help to sort it.

    If anyone could help me out, so a single program can be used for both - old file and new file so the text height remain same (0.5height)

    Using Autocad2013, window10 desktop.

    -Thanks in advance & Regards,
    Lalit
    """"
    -- two files attached for reference, Please change file path is LSP file if required, also note guidance required at place where i have mentioned - - - """ ;START new text style matter print on bearing : 2023-07-01 """ .
    to use these file simply loadapp - location LSP file
    command to run file is - ACB2-3xxx-series, then for a instance you can type/use bearing number/size as -- 3205 & then check the problem.
    Attached Files Attached Files

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    537
    Login to Give a bone
    0

    Default Re: unable to mention Text / name to inserted object with Autolisp program

    My way of doing select an item

    Code:
    ; thanks to Lee-mac for this defun
    (defun csv->lst ( str / pos )
    (if (setq pos (vl-string-position 32 str))
        (cons (substr str 1 pos) (csv->lst (substr str (+ pos 2))))
        (list str)
        )
    )
    
    
    (setq fo (open "c:\\Cad_Support\\acb2-3xxx-series.txt" "R"))
    (setq lst '())
    (while (setq newline (read-line fo))
    (setq str (csv->lst newline))
    (setq str2 '())
    (foreach val str
      (if (= (strlen val) 0)
      (princ)
      (setq str2 (cons val str2))
      )
    )
    (setq str2 (reverse str2))
    (setq lst (cons str2 lst))
    )
    (close fo)
    (setq lst (reverse lst))
    (setq lst2 '())
    (foreach val lst
    (setq lst2 (cons (car val) lst2))
    )
    
    (if (not AHlstbox)(load "Listbox-AH.lsp"))
    (setq num (ahlstbox "Pick a bearing " lst2 20 20))
    ; num is item n in list
    (setq bcode (atoi(nth 0 (nth num lst))))
    (setq di (nth 1 (nth num lst)))
    (setq do (nth 2 (nth num lst)))
    (setq b (nth 3 (nth num lst)))
    (setq r1 (nth 4 (nth num lst)))
    (setq a (nth 5 (nth num lst)))
    screenshot434.png
    Attached Files Attached Files

Similar Threads

  1. get the name of the group object with a Autolisp?
    By ederson_ambrosio in forum AutoLISP
    Replies: 3
    Last Post: 2014-02-08, 03:12 AM
  2. AutoLISP program that converts text height
    By aaronic_abacus in forum AutoLISP
    Replies: 4
    Last Post: 2007-01-09, 12:36 PM
  3. AutoLISP program to convert text styles
    By aaronic_abacus in forum AutoLISP
    Replies: 1
    Last Post: 2007-01-09, 08:51 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
  •