Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/09/2024 in all areas

  1. @grifflicious It looks to me like your trying to load the DCL file and dialog box before it is written. The DCL has to exist before you can load it. Try this - I tested it and it works: (defun CG:legal-dialog() (if LEGAL-EP (progn (if (not (findfile (setq dcl (strcat (getenv "TMP") "\\legal_dialog.dcl")))) (progn (setq des (open dcl "w")) (foreach x '( " info : dialog"; "{" " label = \"Ownership/Recording Info\";" " key = \"dcl\";" " spacer;" " : column " " {" " : boxed_row" " : boxed_column" " {" " spacer;" " : popup_list" " {" " key = \"county\";" " label = \"&County:\";" " width = 30;" " value = \"1\";" " action = \"(setq COUNTY (strcat (get_tile \\\"county\\\")))\";" " }" " }" " : edit_box" " {" " key = \"survey\";" " label = \"Survey:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq SURVEY (get_tile \\\"survey\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"abstract\";" " label = \"Abstract:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq ABSTRACT (get_tile \\\"abstract\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"ownership\";" " label = \"Ownership:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq OWNERSHIP (get_tile \\\"ownership\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"acerage\";" " label = \"Acerage:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq ACERAGE (get_tile \\\"acerage\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"recording\";" " label = \"Recorded In:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq RECORDING (get_tile \\\"recording\\\"))\";" " }" " spacer;" " : boxed_row" " {" " : button " " {" " key = \"accept\";" " label = \"Okay or Use Previous\";" " is_default = true;" " }" " spacer;" " : button " " {" " key = \"cancel\";" " label = \"Cancel\";" " is_default = false;" " is_cancel = true;" " }" " }" " }" " }" ) (write-line x des) ) (close des) ) ) (setq id (load_dialog dcl)) (new_dialog "info" id) (setq COUNTY "XXX") (setq countylistTX '( "Anderson" "Andrews" "Angelina" "Aransas" "Archer" "Armstrong" "Atascosa" "Austin" "Bailey" "Bandera" "Bastrop" "Baylor" "Bee" "Bell" "Bexar" "Blanco" "Borden" "Bosque" "Bowie" "Brazoria" "Brazos" "Brewster" "Briscoe" "Brooks" "Brown" "Burleson" "Burnet" "Caldwell" "Calhoun" "Callahan" "Cameron" "Camp" "Carson" "Cass" "Castro" "Chambers" "Cherokee" "Childress" "Clay" "Cochran" "Coke" "Coleman" "Collin" "Collingsworth" "Colorado" "Comal" "Comanche" "Concho" "Cooke" "Coryell" "Cottle" "Crane" "Crockett" "Crosby" "Culberson" "Dallam" "Dallas" "Dawson" "Deaf Smith" "Delta" "Denton" "DeWitt" "Dickens" "Dimmit" "Donley" "Duval" "Eastland" "Ector" "Edwards" "Ellis" "El Paso" "Erath" "Falls" "Fannin" "Fayette" "Fisher" "Floyd" "Foard" "Fort Bend" "Franklin" "Freestone" "Frio" "Gaines" "Galveston" "Garza" "Gillespie" "Glasscock" "Goliad" "Gonzales" "Gray" "Grayson" "Gregg" "Grimes" "Guadalupe" "Hale" "Hall" "Hamilton" "Hansford" "Hardeman" "Hardin" "Harris" "Harrison" "Hartley" "Haskell" "Hays" "Hemphill" "Henderson" "Hidalgo" "Hill" "Hockley" "Hood" "Hopkins" "Houston" "Howard" "Hudspeth" "Hunt" "Hutchinson" "Irion" "Jack" "Jackson" "Jasper" "Jeff Davis" "Jefferson" "Jim Hogg" "Jim Wells" "Johnson" "Jones" "Karnes" "Kaufman" "Kendall" "Kenedy" "Kent" "Kerr" "Kimble" "King" "Kinney" "Kleberg" "Knox" "La Salle" "Lamar" "Lamb" "Lampasas" "Lavaca" "Lee" "Leon" "Liberty" "Limestone" "Lipscomb" "Live Oak" "Llano" "Loving" "Lubbock" "Lynn" "Madison" "Marion" "Martin" "Mason" "Matagorda" "Maverick" "McCulloch" "McLennan" "McMullen" "Medina" "Menard" "Midland" "Milam" "Mills" "Mitchell" "Montague" "Montgomery" "Moore" "Morris" "Motley" "Nacogdoches" "Navarro" "Newton" "Nolan" "Nueces" "Ochiltree" "Oldham" "Orange" "Palo Pinto" "Panola" "Parker" "Parmer" "Pecos" "Polk" "Potter" "Presidio" "Rains" "Randall" "Reagan" "Real" "Red River" "Reeves" "Refugio" "Roberts" "Robertson" "Rockwall" "Runnels" "Rusk" "Sabine" "San Augustine" "San Jacinto" "San Patricio" "San Saba" "Schleicher" "Scurry" "Shackelford" "Shelby" "Sherman" "Smith" "Somervell" "Starr" "Stephens" "Sterling" "Stonewall" "Sutton" "Swisher" "Tarrant" "Taylor" "Terrell" "Terry" "Throckmorton" "Titus" "Tom Green" "Travis" "Trinity" "Tyler" "Upshur" "Upton" "Uvalde" "Val Verde" "Van Zandt" "Victoria" "Walker" "Waller" "Ward" "Washington" "Webb" "Wharton" "Wheeler" "Wichita" "Wilbarger" "Willacy" "Williamson" "Wilson" "Winkler" "Wise" "Wood" "Yoakum" "Young" "Zapata" "Zavala")) (start_list "county" 3) (mapcar 'add_list countylistTX) (end_list) (setq result (start_dialog)) (unload_dialog id) ) ) )
    1 point
  2. If you can get used of the Right-Left definition, then use this. It now does any angle (again: line from right to left, add 90 ° clockwise, that's the direction of the tube/duct) EDIT: - Oh yes, and I join the lines and arcs to 1 polyline. - And I set it to the right layer, color, linetype and lt scale Then you can use Tharwat's code to make the wrapping (vl-load-com) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; https://www.cadtutor.net/forum/topic/32405-looking-for-the-join-polyline-lisp-that-is-in-this-forum/?do=findComment&comment=261544 ;; Polyline Edit, Join (defun c:pj ( / pe ss ) (setq pe (getvar 'PEDITACCEPT)) (setvar 'PEDITACCEPT 1) (if (setq ss (ssget "_:L" '((0 . "ARC,LINE,LWPOLYLINE")))) (command "_.pedit" "_M" ss "" "_J" "" "") ) (setvar 'PEDITACCEPT pe) (princ) ) ;; SS is a ssget selection (could be made with ssadd of course) of "ARC,LINE,LWPOLYLINE"... ;; (defun pj (ss / pe ) ;; (setq ss (ssget "_:L" '((0 . "ARC,LINE,LWPOLYLINE")))) (setq pe (getvar 'PEDITACCEPT)) (setvar 'PEDITACCEPT 1) (if ss (command "_.pedit" "_M" ss "" "_J" "" "") ) (setvar 'PEDITACCEPT pe) (entlast) ;; return the newly made polyline object ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @file (defun r2d (r / ) (/ (* r 180.0) pi) ) (defun d2r (d / ) (* (/ d 180.0) pi) ) ;; midpoint of 2 given points (defun mid ( pt1 pt2 / ) (mapcar '(lambda (x y) (+ (* 0.5 x) (* 0.5 y))) pt1 pt2 ) ) (defun drawLWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) (defun drawLine (p1 p2) (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2)))) ;; command DFT, for Draw Flexible Tube (defun c:DFT ( / p1 p2 pm p3 p4 p5 duct_diam ang1 ang2 kink1 kink2 pl1 pl2 pl3 fillet1 fillet2 duct) (setq p1 (getpoint "\nPoint 1 (right edge of the base): ")) (setq p2 (getpoint p1 "\nPoint 2 (left edge of the base): ")) (setq pm (mid p1 p2)) (setq duct_diam (distance p1 p2)) ;; read angle. minus 90°, that's the angle of the first vertex of the duct (setq ang1 (- (angle p1 p2) (d2r 90.0))) (princ (r2d ang1)) (princ "\nDuct diameter: ") (princ duct_diam) (princ " - angle: ") (princ (r2d ang1)) (setq p4 (getpoint "\nPoint 4: (right edge of the end): ")) (setq p5 (getpoint "\nPoint 5: (left edge of the end): ")) (setq p3 (mid p4 p5)) (setq ang2 (- (angle p4 p5) (d2r 90.0))) ;;(setq p3 (getpoint "\nPoint 3: (middle of the top): ")) ;; step 1, we need a point perpendicular to p1-p2, length = distance p1-p2 (setq kink1 (polar pm ang1 duct_diam)) ;; dito for endpoint. I assume the top is always horizontal (setq kink2 (polar p3 ang2 duct_diam)) ;; We draw 3 lines. (setq pl1 (drawLine pm kink1)) (setq pl2 (drawLine kink1 kink2)) (setq pl3 (drawLine kink2 p3)) ;; now fillet (setvar "FILLETRAD" duct_diam) (command "_.fillet" pl2 pl1) (setq fillet1 (entlast)) (command "_.fillet" pl2 pl3) (setq fillet2 (entlast)) ;; Now we'll join these lines and arcs to 1 polyline. We first put them in a ss selection (setq duct (ssadd)) (ssadd pl1 duct) (ssadd fillet1 duct) (ssadd pl2 duct) (ssadd fillet2 duct) (ssadd pl3 duct) (setq duct (pj duct)) ;; linetype and scale (setq obj (vlax-ename->vla-object duct)) (vla-put-layer obj "MF_Flexo") (vla-put-color obj 7) ;; 7 = white (vla-put-linetype obj "TRACKS") (vla-put-linetypescale obj 320) (princ) )
    1 point
  3. Sorry about missing all the posts, but here it is the final version ;;; Enclose Texts with Round(), Square[], Curly{}, sTraight||, Forward//, Backward\\ ;;; Isaac A 20240208 (vl-load-com) (defun c:ent (/ a b c d dw e f g o oe) (setq oe (getvar 'cmdecho) o (getvar 'osmode) ) (setvar 'cmdecho 0) (vla-startundomark (setq dw (vla-get-activedocument (vlax-get-acad-object)))) (setvar 'osmode 0) (princ "\nSelect the texts.") (if (setq a (ssget (list (cons 0 "TEXT,MTEXT")))) (progn (initget "Round Square Curly sTraight Forward Backward frQuotes") (setq b 0 c (sslength a) d (getkword "Round(), Square[], Curly{}, sTraight||, Forward//, Backward\\\\, frQuotes«» <R>: ") ) (while (< b c) (setq e (entget (ssname a b)) f (cdr (setq g (assoc 1 e))) ) (cond ((= d "Round") (setq f (strcat "("f")"))) ((= d "Square") (setq f (strcat "["f"]"))) ((= d "Curly") (if (= (cdr (assoc 0 e)) "TEXT") (setq f (strcat "{"f"}")) (setq f (strcat "\\{"f"\\}")) ) ) ((= d "sTraight") (setq f (strcat "|"f"|"))) ((= d "Forward") (setq f (strcat "/"f"/"))) ((= d "Backward") (setq f (strcat "\\"f"\\"))) ((= d "frQuotes") (setq f (strcat "«"f"»"))) (T (setq f (strcat "("f")"))) ) (setq e (subst (cons 1 f) g e)) (entmod e) (setq b (1+ b)) ) ) (princ "\nNo texts selected") ) (setvar 'cmdecho oe) (setvar 'osmode o) (vla-endundomark dw) (princ) ) But you can Modify it with numbers @Nikon because the cyrillic alphabet is different Also @BIGAL Nice way of using your Multi Radio Buttons.lsp, I'll follow the example to include DCL code in my lisps, or is there an easier way?, maybe not, I'll let you know how it goes.
    1 point
  4. I posted an extra line above but not there it was a get application for libreoffice not on pc at moment will resend. Found it after googling a bit. Maybe another forum ? Need it tested in ACAD (setq libre (vlax-get-or-create-object "com.sun.star.ServiceManager")) Also in the Excel macro, 'Check if the active space is paper space and change it to model space. If acadDoc.ActiveSpace = 0 Then Set acadDoc.ActiveSpace = 1 '0 = acPaperSpace in early binding '1 = acModelSpace in early binding End If I am thinking maybe go to Librecad calc as Excel and Word have become expensive for a casual user.
    1 point
  5. There is code out there for internal external angle. Again the issue of CW CCW pline I think may creep in. The ends are easy in a manual sense drag line over near ends gets the two plines so know which way to draw short lines, the single corner just pick corner get vertices and check in out angle then draw line note at 1/2 angle. No cad at moment.
    1 point
×
×
  • Create New...