Leaderboard
Popular Content
Showing content with the highest reputation on 10/27/2022 in all areas
-
This opens the default browser and wouldn't need that 2nd function to run. (vl-cmdf "_.Browser" sitio)2 points
-
Have you tried using the Design Center? See this article. About halfway down the page they discuss searching for blocks.2 points
-
2 points
-
2 points
-
1 point
-
Setup a template drawing and and save dimension styles. You can use his steal function to copy the style into a new drawing with this. (defun C:DStyle () (Steal "C:\\path\\to\\drawing\\that\\has\\dims.dwg" '(( "Dimension Styles" ("Dim Name")))) (princ) ) --edit textoverride isn't part of the dimstyles and would need to be inputted for each dimension. I would also suggest to use a prefix to show that its an overridden dimension. * or [ORD] 8'0" - no idea text is overridden *8-'0" [ORD] 8-'0" * 8-'0" *1 point
-
1 point
-
Yeah, those are weirdly made Mtext objects. Here's the contents of the top one: (1 . "{\\Fstandard|c134;X9\\Fstandard|c0;2\\Fstandard|c134;/\\Fstandard|c0;5\\Fstandard|c134;S}") So every letter is put in a different style for some reason. And this causes Explode to explode it to all separate letters1 point
-
Try un formatting first then explode. https://www.cadtutor.net/forum/topic/73909-mtext-height-vs-text-formatting-height-need-to-change-all-to-a-different-height/1 point
-
Hi, looking for a solution to automatically create layouts starting from a grid in model space I found the PlotDWGarr.vlx lisp (here: https://www.cadforum.cz/en/download.asp?fileID=1172). I use the associated lisp LayDWGarr. I also saw a tutorial on how it works (here: https://www.youtube.com/watch?v=nNiIVZvqXLk). It seems to me that I have done everything correctly, the layout template (PlotArrTemplate), the succession of entry points etc. but the layouts that are generated always point only to box A01. I doubt it's the lisp that's malfunctioning, but I don't understand what I could have done wrong. What could be wrong with my file? Do you know of an alternate lisp that performs the operation I am trying to do? Thank you in advance GRIGLIA A3 A-O 1-30.dwg1 point
-
I don't have a whatsapp so can't check this but I guess the user needs to have whatsapp and to have set up in the web browser for this to work. Not sure what happens if the target does not have a whatsapp - guess they just get a text message? Others will have to change 'chrome.exe' in the first defun depending on their browser, mine is MS edge so use "msedge.exe" instead for example1 point
-
1 point
-
This should work command CTFM: Create Table From Mtext (vl-load-com) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Removes non-numeric characters from a string ;; https://forums.autodesk.com/t5/autocad-forum/lisp-for-extract-number-value-from-between-text-string/m-p/3609272#M193744 (defun numbers-in-string1 (str) ;; Removes the non-numeric characters from a string (vl-list->string (vl-remove-if-not 'num-char-p (vl-string->list str))) ) (defun num-char-p (char) ;; Does (chr num) represent a numeric character (0...9)? ;;(< 46 char 58) (and (> char 46) (< char 58) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; http://www.lee-mac.com/listtostring.html ;; List to String - Lee Mac ;; Concatenates each string in a supplied list, separated by a given delimiter ;; lst - [lst] List of strings to concatenate ;; del - [str] Delimiter string to separate each item (defun LM:lst->str ( lst del ) (if (cdr lst) (strcat (car lst) del (LM:lst->str (cdr lst) del)) (car lst) ) ) ;; String to List - Lee Mac ;; Separates a string using a given delimiter ;; str - [str] String to process ;; del - [str] Delimiter by which to separate the string ;; Returns: [lst] List of strings (defun LM:str->lst ( str del / pos ) (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (LM:str->lst (substr str (+ pos 1 (strlen del))) del)) (list str) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; make a table (defun inserttable (lst pt / ht htc tab i j row tb acObj acDoc space width_cols) ;; settings, text height, cel height (setq ht 12.0) (setq htc 30.0) ;; widths of the columns. Feel free to adapt (setq width_cols (list 80.0 200.0 200.0 80.0 )) ;; document, model space, ... (setq acObj (vlax-get-acad-object) acDoc (vla-get-activedocument acObj) space (vlax-get acDoc (if (= 1 (getvar 'cvport)) 'PaperSpace 'ModelSpace)) ) (setq tab (vla-addtable space (vlax-3d-point pt) (length lst) (length (cadr lst)) (* 1.1 ht) (* 10.0 ht) )) ;; (vla-SetTextHeight tab 1 ht) (vla-SetTextHeight tab 2 ht) (vla-SetTextHeight tab 4 ht) (vla-put-VertCellMargin tab (* 0.3 ht)) (vla-put-HorzCellMargin tab (* 0.3 ht)) (setq i 0) (repeat (length lst) ;; iterates the rows (vla-setrowHeight tab i htc) (setq row (nth i lst)) (setq j 0) (repeat (length row) ;; iterates the cols in the row ;; (textbox (list (cons 1 (to_string x)) (cons 7 (getvar 'textstyle)) (cons 40 ht) )) (vla-SetColumnWidth tab j (nth j width_cols) ) (vla-SetText tab i j (nth j row) ) (setq j (+ j 1)) ) (setq i (+ i 1)) ) ;; default Autocad expects a title row. If the first row has more than 1 cel, let's unmerge this row (if (> (length (nth 0 lst)) 1) (vla-unMergeCells tab 0 0 0 0) ) ;; Merge last row, to show total ;; but we don't need this here ;; MergeCells minRow, maxRow, minCol, maxCol ;;(vla-MergeCells tab (- (length lst) 1) (- (length lst) 1) 0 3) tab ) ;; test of inserttable (defun c:ila ( / ) (inserttable (list (list "P.NO" "EASTING" "NORTHING" "ELEV." ) (list "P1" "20.5" "30.5" "40.5" ) (list "P2" "50.5" "60.5" "70.5" ) ) (getpoint "\nInsert point of table: ") ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; command CTFM: Create Table From Mtext (defun c:ctfm ( / ss i rows cels str last_cel sp) ;; user selects Mtext elements (princ "\nSelects Mtext elements: ") (setq ss (ssget (list (cons 0 "MTEXT") (cons 8 "E-Text")))) (setq i 0) (setq rows (list (list "S.no." "Item No." "Material" "Qty."))) (repeat (sslength ss) ;; read text contents of the Mtext (setq str (cdr (assoc 1 (entget (ssname ss i))))) ;; split the text by "/" (setq cels (LM:str->lst str "/")) ;; for example "1497-1/1.4000/410S-2x" is now (list "1497-1" "1.4000" "410S-2x") ;; We'll split that last "410S-2x" to (list "410S" "2x"), then remove the X (setq last_cel (LM:str->lst (nth 2 cels) "-")) ;; now we assemble the row and add it to the list of rows (setq rows (append rows (list (list (itoa (+ i 1)) (nth 0 cels) (strcat ;; re-attach the middle cels (nth 1 cels) "/" (nth 0 last_cel) ) (numbers-in-string1 (nth 1 last_cel)) )))) (setq i (+ i 1)) ) (princ rows) (setq sp (getpoint "\nPick top left point of the table: ")); or use getpoint (inserttable rows sp) (princ ) )1 point
-
I finally got this function. I share it in case someone might be interested. It even works with your own phone number. There are two options: indicate the phone number to which you want to send the message. Or do not indicate the number so that whatsapp opens the contact list. (defun open_url_in_chrome (url / sa);by ronjonp (and (setq sa (vlax-get-or-create-object "Shell.Application")) (null (vlax-invoke sa 'shellexecute "chrome.exe" url)) (vlax-release-object sa) ) ) (defun c:wha () (setq mi_numero "34123456789");número de teléfono al que deseas enviar el mensaje, con el código internacional de pais (setq n 1) (while (setq pt (getpoint"\nIndica un punto: ")) ;(setq mensaje (strcat "Punto%20" (itoa n) "-->%20" "X=" (rtos (car pt) 2 3) "%20/%20Y=" (rtos (cadr pt) 2 3) "\r")) (setq mensaje (strcat "Punto%20" (itoa n) "-->%20" "X=" (rtos (car pt) 2 3) "%20/%20Y=" (rtos (cadr pt) 2 3))) ;OPCION 1: abre lista de contactos de whatsapp para seleccionar en contacto a quien enviar el mensaje (setq sitio (strcat "https://api.whatsapp.com/send?text=" mensaje)) ;OPCIÓN 2: envía mensaje a un número te teléfono concreto ;(setq sitio (strcat "https://api.whatsapp.com/send?phone=" mi_numero "&text=" mensaje)) (open_url_in_chrome sitio) (setq n (1+ n)) ) )1 point
-
I've changed this slightly to vla-insertblock because its seems slightly quicker but its still very slow, would I the possible to insert the block at the start point then copy the block along the line at specific points? I saw in the 'copyalongcurvelsp' a func which copies the block along the line but I'm having issues trying to selected the specific block (by name if possibe), the best I could get was to inset the block to 0 0 0 coordinated then selected via co-ords but the only issue with this is the block has to be rendered in and not overlapping with anything else. I want to selected just the cone block (I've removed the dcl for now and hard coded a distance in just to shorten the code for now) (defun c:testing () (setq pline (vlax-ename->vla-object (car (entsel "\nSelect polyline: "))) len (vla-get-length pline) ) (setvar 'clayer "0") (setq dist 3) (repeat (fix (/ len 3)) (vla-insertblock (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-curve-getpointatdist pline dist) "C:\\BricsCAD Scripts\\Tools\\Blocks\\Cone.dwg" 0.3 0.3 0.3 0 ) (setq dist (+ dist 3)) ) )1 point
-
Gcen is a snap that can be used to do just that. Must be say closed pline to work. (setq pt (osnap (vlax-curve-getStartPoint (vlax-ename->vla-object (car (entsel "Pick obj")))) "gcen"))1 point
-
Maybe its because I didn't have (vl-load-com) its there now. but everything is working on this end. https://ibb.co/j8HPK1x @lrm bounding box is for the text only.1 point
-
The center of the bounding box is not the same as the centroid. Perhaps the program could use the selected polylines to create regions that were then unioned. Massprop could then be used to determine the centroid for the collection of regions. But how do you access the results of massprop in vlisp?1 point
-
This will ask you to select a text but it could be anything really find the midpoint of the bounding box around selected item ask for polylines to be selected make a copy the first selected item to the geo center of the polylines ;;----------------------------------------------------------------------------;; ;; Copy text to the geo center of polyline(s) (defun C:foo (/ txt BP SS poly PT newtxt) (vl-load-com) (setq txt (vlax-ename->vla-object (car (entsel "\nSelect Text to Move")))) (vla-getboundingbox txt 'minpt 'maxpt) (setq BP (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2))) ;midpoint of text (prompt "\nSelect Polyline") (if (setq SS (ssget '((0 . "*POLYLINE")))) (foreach poly (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq PT (osnap (vlax-curve-getStartPoint poly) "gcen")) (setq newtxt (vla-copy txt)) (vla-move newtxt (vlax-3d-point BP) (vlax-3d-point pt)) ) ) (princ) )1 point
-
Copy any number of selected objects along a selected curve object (Arc, Circle, Ellipse, Line, LWPolyline, 2DPolyline, 3DPolyline, Spline) using a specified base point. Copy options: Divide, Measure and Dynamic. Starting point is based on closest end point to where curve is selected. Works in non-WCS. User has option to align object(s) to selected curve. (03.28.10) Instead of selecting a curve, user has option to pick points, temporarily drawing a Polyline to copy along. (03.28.10) If 'Align objects' option is selected, user has additional rotation option when copying has completed (90°, 180°, 270°). (03.28.10) Enjoy and all comments are greatly appreciated. Divide option: Measure option: Dynamic option: Updated display align, drawing temporarily polyline and additional rotation options. Updated: 03.30.10 (v1.1) CopyAlongCurve.LSP1 point
-
Give this a try: (defun c:DimExport (/ i ss file e d) ;; Lee Mac ~ 08.04.10 (if (and (setq i -1 ss (ssget '((0 . "DIMENSION")))) (setq file (getfiled "Output" "" "txt;csv" 1))) (progn (setq file (open file "w")) (while (setq e (ssname ss (setq i (1+ i)))) (setq d (cdr (assoc 42 (entget e)))) (write-line (if (or (= 2 (logand 2 (cdr (assoc 70 (entget e))))) (= 5 (logand 5 (cdr (assoc 70 (entget e)))))) (angtos d (getvar 'DIMAUNIT) (if (minusp (getvar 'DIMADEC)) (getvar 'DIMDEC) (getvar 'DIMADEC))) (rtos d (getvar 'DIMLUNIT) (getvar 'DIMDEC))) file)) (close file))) (princ))1 point
-
Updated with a few new features. Features documented above and shown in last video. Happy CAD'ing.1 point