Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/21/2023 in all areas

  1. I've created a tool to assist me with a mammoth job I'm working on right now. I have to dig through an enormous amount of folders and data to catalog everything and search for lost and relevant data , in all sorts of format , dwg , doc , excell etc. Purpose of app I gave birth to this time is to present data in whatever form that's best for daddy (or mommy? ... nah dragons don't have this problem) Anyways , I'm on a quota so have to deliver certain amount of data in a certain amount of time and have to put in spare time when behind schedule so no time to explain everything so I hope interface explains itself. Also can't say for certain I've killed all bugs because ink is still wet. So short version : start app , type h for help , s for setup in Main dialog. In setup dialog you can create some test drawings or variables. Files can be represented as button , image_button , edit_box, list_box or toggle. App can also work in data mode. In main dialog you select folder (with drawings or doc's etc) , next extention (dwg, doc, xls ext) , action type (insert , open ...) and dcl type (button, edit_box etc) and ok. New dialog is created : Run dialog. here you can also type h for help. You can type r to rotate dialog , 4 = smaller , 6 is wider , 8 = higher , 2 = less higher and if dcl type is image_tile you can also use + & - keys to resize slides. Oh , thinks save button doesn't work yet. What else to tell... well , haven't done enough testing probably , and time will tell if this is gonna help me to achieve my goals or if its just another useless stupid program. I don't expect I will have much time for chitchat so have fun or trashcan... RlxIndexer.lsp
    4 points
  2. Consider something like the following: (while (not (or (= "" (setq nodwg (getstring "\nEnter the number <exit>: "))) (wcmatch nodwg "###") ) ) (princ "\nNumber must be in the range 001-999.") ) (if (/= "" nodwg) (progn ;; do stuff ) )
    3 points
  3. Hatched..... Eggs hatch..... I'll save this away - looks like a load of useful stuff in there
    3 points
  4. Not 100%, but I think you cannot do this that way, you can't put bold on Arial.ttf. Arial and Arial bold are different fonts. So for group code 3 you have to put: '(3 . "Arial Bold.ttf")
    2 points
  5. @exceed , there was indeed a special character on this line. It didn't affect working on my computer(s) but I've removed it and uploaded it again in case more users have the same problem. Thanx for the feed back
    2 points
  6. This is what I use for leading 0's (defun AT:NumFix (s n) ;; Fix number string with leading zeros ;; s - Number string to fix ;; n - Number of characters for final string ;; Alan J. Thompson, 10.29.09 ;; (AT:NumFix i 3) i= 1 = 001 (if (< (strlen s) n) (AT:NumFix (strcat "0" s) n) s ) ) (defun c:test (/ pre tmp) (if (and (setq pre (getint "Enter Drawing Number: ")) (> pre 0) (< pre 999)) (setq tmp (AT:NumFix (itoa pre) 3)) (Alert "\nNumber must be in the range 001-999.") ) tmp )
    1 point
  7. My first thought was to use getint, below works if you want the file number to have leading zeros (for numbers below 100). (defun c:test ( / tmp pre) (setq tmp "") (setq pre (getint "Enter Drawing Number: ")) (if (< pre 10)(setq tmp "0")) (if (< pre 100)(setq tmp (strcat tmp "0"))) (setq pre (strcat tmp (rtos pre))) )
    1 point
  8. This works. I called it command STAPLE. It both extends and trims (vl-load-com) ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-get-the-z-coordinate-of-3d-polyline/td-p/2435197 ;; Poly-Pts ;;; returns a list of the polyline vertices WCS coordinates ;;; Argument: a polyline (ENAME or VLA-OBJECT) (defun poly-pts (p / n l) (setq n (fix (vlax-curve-getEndParam p))) (or (vlax-curve-IsClosed p) (setq n (1+ n))) (repeat n (setq l (cons (vlax-curve-getPointAtParam p (setq n (1- n))) l)) ) ) (defun c:staple ( / i shortSize ss pl newpoints ang1 ang2 dist1 dist2) (setq shortSize (getdist "\Short size distance: ")) (setq ss (ssget (list (cons 0 "*POLYLINE")))) (setq i 0) (repeat (sslength ss) (setq pl (ssname ss i)) ;; read vertex points (setq pts (poly-pts pl)) ;; let's see which is the long side. ;; for 4 vertices it's the middle line ;; for 3 vertices it can be any of both lines. (if (= (length pts) 4) (progn (setq ang1 (angle (nth 1 pts) (nth 0 pts))) (setq dist1 (distance (nth 1 pts) (nth 0 pts))) (setq ang2 (angle (nth 2 pts) (nth 3 pts))) (setq dist2 (distance (nth 2 pts) (nth 3 pts))) ;; make a new list of coordinates (setq newpoints (list (nth 0 (polar (nth 1 pts) ang1 shortSize)) (nth 1 (polar (nth 1 pts) ang1 shortSize)) (nth 0 (nth 1 pts)) (nth 1 (nth 1 pts)) (nth 0 (nth 2 pts)) (nth 1 (nth 2 pts)) (nth 0 (polar (nth 2 pts) ang2 shortSize)) (nth 1 (polar (nth 2 pts) ang2 shortSize)) )) (vlax-put (vlax-ename->vla-object pl) 'coordinates newpoints) ) ) (if (= (length pts) 3) (if (< (distance (nth 1 pts) (nth 0 pts)) (distance (nth 1 pts) (nth 2 pts)) ) (progn ;; first line is the short line (setq ang1 (angle (nth 1 pts) (nth 0 pts))) (setq dist1 (distance (nth 1 pts) (nth 0 pts))) ;; make a new list of coordinates (setq newpoints (list (nth 0 (polar (nth 1 pts) ang1 shortSize)) (nth 1 (polar (nth 1 pts) ang1 shortSize)) (nth 0 (nth 1 pts)) (nth 1 (nth 1 pts)) (nth 0 (nth 2 pts)) (nth 1 (nth 2 pts)) )) (vlax-put (vlax-ename->vla-object pl) 'coordinates newpoints) ) (progn ;; second line is the short line (setq ang2 (angle (nth 1 pts) (nth 2 pts))) (setq dist2 (distance (nth 1 pts) (nth 2 pts))) ;; make a new list of coordinates (setq newpoints (list (nth 0 (nth 0 pts)) (nth 1 (nth 0 pts)) (nth 0 (nth 1 pts)) (nth 1 (nth 1 pts)) (nth 0 (polar (nth 1 pts) ang2 shortSize)) (nth 1 (polar (nth 1 pts) ang2 shortSize)) )) (vlax-put (vlax-ename->vla-object pl) 'coordinates newpoints) ) ) ) (setq i (+ i 1)) ) (princ) )
    1 point
  9. This might be a clue: (3 . "arial.ttf") (4 . "") (3 . "arialbd.ttf") (4 . "") You can get the codes for a style using this:, where 'name' is the font name (for example "STANDARD") (setq style (tblobjname "style" name)) (entget style)
    1 point
  10. maybe just my problem. (It's probably a language encoding issue) it works after I correct this in line 269. ? to \ after File mode ":radio_row {:radio_button {key=\"rb_file_mode\";label=\" File mode ?";}" this is cool. I will study some more. thanks
    1 point
  11. (defun c:tx2 ( / ss ssl index ent obj ) (vl-load-com) ; Loads Visual LISP extensions to AutoLISP (princ "\n Select Texts to Change Height to 2") ; ssget doesn't take small talk as an argument, ; so if there's anything you want to say to the user, write it separately at the front. (setq ss (ssget ":L" '((0 . "TEXT")))) ; Insert TEXTs from among those selected by the user into the variable ss. ":L" is an option to exclude locked layers. (setq ssl (sslength ss)) ; Find out how many objects in ss. (setq index 0) ; To use it within repeat, first declare the index as 0. (repeat ssl ; Repeat as many times as ss. (setq ent (ssname ss index)) ; get only 1 item from ss into ent with ssname. ; When extracting something from a list (nth index list), note that the order is different. (setq obj (vlax-ename->vla-object ent)) ; You can directly edit the ent list by subst, assoc, and cons or something. ; but since it is hard for starter to memorize the list numbers what is that property. so convert to object. (vlax-put-property obj 'height 2) ; Set the height value to 2 in this obj. (setq index (+ index 1)) ; Add 1 to index, place it back in index, and end the turn. After this, ; it goes up again to (setq ent (ssname ss index)) by repeat. ) (princ) ; to silence the parrot-like repetition of the last value. ) I don't know what setpropertyvalue or pnt pnt2 are for, but if you only change the text height to 2, Since mhupp already gave a good answer with foreach, I will write with repeat.
    1 point
  12. See futher in the post about using different TTF fonts for bold, at least with Arial. Create the font in style dialog, then (tblsearch "style" yourstyle) to see the DXF codes.
    1 point
  13. What you could do is type in some text, formatted as you like, bold, italic, underlined whatever then use (entget (car (Entsel "Select text: "))) which will list all the dxf codes in use - should be clearer then what you can do For dtext - might be wrong - but bold is defined by the font you select rather in the text, and for mtext it is a code contained within the text string rather than as part of the text definition. Dxf code 7 to change to a different font. You might have for example a font "Arial" and also "Arial_Bold" EDIT - whoops, I'd read your question wrong and was answering the wrong thing!
    1 point
  14. entsel returns the entity name and the point of our curser. (entity<asfasdf> (x, y)) ssget returns a list of entity names and the last point selected with the mouse. The code would work but for only the first entity in the selection set. You need to step thought the entire list of entity names for it to work properly. I like using the foreach function. Code untested but should work. (defun c:TH2 (/ ss pnt) (while (setq ss (ssget ":L" '((0 . "TEXT") ))) ;Selects only text on unlocked layers (foreach txt (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq pnt (trans (cdr (assoc 10 (entget txt))) 0 1)) (setpropertyvalue txt "Height" 2) ) ) (princ) )
    1 point
  15. Thank you very much. I will try it today itself and revert back to you with hopefully good results.
    1 point
  16. Sorry for the delay .. got a bit busy and needed to rewrite most of that other code ... please double check the numbers! (defun c:ild (/ a flg p s) ;; RJP » 2020-08-17 (or *emspc* (setq *emspc* 18.)) (or *rowspc* (setq *rowspc* 12.)) (or *eflow* (setq *eflow* 0.77)) (setq *emspc* (cond ((getint (strcat "\nEnter emitter spacing in tubing (inches):<" (rtos *emspc* 2 1) ">") ) ) (*emspc*) ) ) (setq *rowspc* (cond ((getint (strcat "\nEnter spacing between rows (inches):<" (rtos *rowspc* 2 1) ">")) ) (*rowspc*) ) ) (setq *eflow* (cond ((getint (strcat "\nEnter emitter flow (gph):<" (rtos *eflow* 2 2) ">"))) (*eflow*) ) ) (setq flg (> (getvar 'lunits) 2)) (if (setq s (ssget '((0 . "*POLYLINE,CIRCLE,REGION,ELLIPSE,SPLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (redraw e 3) (setq a (vlax-curve-getarea e)) ;; This portion could be updated to insert the text in the center of the bounding box if you'd like ( no picking required ) (if (setq p (getpoint "\nPick a point to place text: ")) (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(67 . 0) '(8 . "InlineDripNumbers") '(100 . "AcDbMText") (cons 10 p) ;; Adjust text height here (cons 40 (getvar 'textsize)) '(71 . 5) (cons 1 (strcat "AREA (SQ FT): " (rtos a (getvar 'lunits) 2) "\\PFLOW (GPM): " (rtos (* (/ (* a (if flg 1. 144. ) ) (* *emspc* *rowspc*) ) (/ *eflow* 60.) ) 2 2 ) ) ) '(11 1. 0. 0.) '(43 . 0.125) '(50 . 0.) ) ) ) (redraw e 4) ) ) (princ) ) (vl-load-com)
    1 point
  17. Try the Rename command Old Name > L* Rename to > *
    1 point
×
×
  • Create New...