Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/10/2024 in all areas

  1. @thekiki Your Welcome. I suggest you use these as examples to start learning how to do your own AutoLISP routines.
    1 point
  2. @thekiki Try This version: (defun c:Selpline (/ p1 p2 ss) (if (and (setq p1 (getpoint "\nSelect 1st corn of cossing window: ")) (setq p2 (getcorner p1 "\nSelect 2nd point of crossing window: ")) (setq ss (ssget "C" p1 p2 '((0 . "*POLYLINE")))) ) (sssetfirst nil ss) ) ss ) (defun c:Seltext (/ p1 p2 ss) (if (and (setq p1 (getpoint "\nSelect 1st corn of cossing window: ")) (setq p2 (getcorner p1 "\nSelect 2nd point of crossing window: ")) (setq ss (ssget "C" p1 p2 '((0 . "*TEXT")))) ) (sssetfirst nil ss) ) ss ) (defun c:Selblock (/ p1 p2 ss) (if (and (setq p1 (getpoint "\nSelect 1st corn of cossing window: ")) (setq p2 (getcorner p1 "\nSelect 2nd point of crossing window: ")) (setq ss (ssget "C" p1 p2 '((0 . "INSERT")))) ) (sssetfirst nil ss) ) ss )
    1 point
  3. Hello Dszlapka, welcome in the forum! I am in vacation right now, I can't test it, but the "strcat" method should work. (defun c:KT_dlugosc ( / poly att) (while (and (setq poly (ssget "_+.:S:E" '((0 . "*LINE")))) (setq att (car (nentsel "\nSelect Attribute"))) (eq "AcDbAttribute" (vla-get-objectname (setq att (vlax-ename->vla-object att))) ) ) (vlax-put att 'TextString (strcat (rtos (vlax-curve-getDistAtParam (setq poly (ssname poly 0)) (vlax-curve-getEndParam poly) ) 2 0 ) "m") ) )(princ) ) Please try this code and post a feed-back. Post the error message you get, for sure someone will be able to fix it!
    1 point
  4. Perhaps something like: ([color=BLUE]defun[/color] _getfontlist ( [color=BLUE]/[/color] _parsepaths ) ([color=BLUE]defun[/color] _parsepaths ( s [color=BLUE]/[/color] p ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] p ([color=BLUE]vl-string-position[/color] 59 s)) ([color=BLUE]vl-remove[/color] [color=MAROON]""[/color] ([color=BLUE]cons[/color] ([color=BLUE]substr[/color] s 1 p) (_parsepaths ([color=BLUE]substr[/color] s ([color=BLUE]+[/color] p 2))))) ([color=BLUE]list[/color] s) ) ) ([color=BLUE]vl-sort[/color] ([color=BLUE]apply[/color] '[color=BLUE]append[/color] ([color=BLUE]cons[/color] ([color=BLUE]vl-directory-files[/color] (LM:SpecialFolder [color=MAROON]"Fonts"[/color]) [color=MAROON]"*.ttf"[/color] 1) ([color=BLUE]mapcar[/color] ([color=BLUE]function[/color] ([color=BLUE]lambda[/color] ( p ) ([color=BLUE]vl-directory-files[/color] p [color=MAROON]"*.shx"[/color] 1)) ) (_parsepaths ([color=BLUE]getenv[/color] [color=MAROON]"ACAD"[/color])) ) ) ) '[color=BLUE]<[/color] ) ) [color=GREEN];; Special Folder - Lee Mac[/color] [color=GREEN];; Queries the WshSpecialFolders collection for the specified folder[/color] [color=GREEN];; Ref: http://msdn.microsoft.com/en-us/library/9x9e7edx%28v=vs.85%29.aspx[/color] ([color=BLUE]defun[/color] LM:SpecialFolder ( folder [color=BLUE]/[/color] res spf wsh ) ([color=BLUE]setq[/color] res ([color=BLUE]vl-catch-all-apply[/color] ([color=BLUE]function[/color] ([color=BLUE]lambda[/color] ( ) ([color=BLUE]setq[/color] wsh ([color=BLUE]vlax-get-or-create-object[/color] [color=MAROON]"wscript.shell"[/color]) spf ([color=BLUE]vlax-get-property[/color] wsh 'specialfolders) ) ([color=BLUE]vlax-invoke-method[/color] spf 'item folder) ) ) ) ) ([color=BLUE]if[/color] spf ([color=BLUE]vlax-release-object[/color] spf)) ([color=BLUE]if[/color] wsh ([color=BLUE]vlax-release-object[/color] wsh)) ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]vl-catch-all-error-p[/color] res)) res ) ) (untested code)
    1 point
  5. (defun _List (typ / lst) (while (setq e (tblnext typ (null e))) (setq lst (cons (cdr (assoc 2 e)) lst))) lst ) usage ... With Layers ... (_List "Layer") usage ... With Text Styles ... (_List "Style")
    1 point
×
×
  • Create New...