Leaderboard
Popular Content
Showing content with the highest reputation since 11/03/2026 in Posts
-
A couple of points to make: The need to create thousands of variables on-the-fly typically points to poor program design; in almost every case, a list is more suitable. Setting all such variables to nil at the end of the program does clear them from the document namespace, but consider that you are essentially creating & clearing global variables that are not local to the scope of your program, and as such, the variable names could potentially clash with identically named variables in the document namespace - this is generally considered bad practice.5 points
-
sure : (alert "Press ok to start your 30hr day") anything else I can do for you?2 points
-
@PGia While it's very possible to create variables on the fly. I agree with Lee that it should not be a method to use, especially in the way you are wanting to use it. That being said, I wrote the following many years ago, but hardly have ever used it for anything. It accepts an assoc. list of strings representing variables and the corresponding values, then creates a variable for each with the value. The core of it is very simple (set (read "StrVar") value) ;|============================================================================== Function Name: (pjk-dynsetvar) Arguments: assoclst = List of cons; an assoc list on the format: (list (cons "<var name1>" <value1>) ... (cons "<Var namN>" <valueN>)) Usage: (pjk-dynsetvar <Assoc. List>) Ex: (pjk-dynsetvar (list (cons "Cenpt" (list 1.0 1.0 0.0)) (cons "Radius" 0.25))) Returns: The results of the read list. You can verify the variables with the ! prefix: Command line Example: Command: (pjk-dynsetvar (list (cons "Cenpt" (list 1.0 1.0 0.0)) (cons "Radius" 0.25))) ((1.0 1.0 0.0) 0.25) Command: !Cenpt (1.0 1.0 0.0) Command: !Radius 0.25 Description: This function dynamically sets AutoLISP variables based on an association list of strings and values. The string keys represent the names of the variables that the values will be assigned to. ================================================================================|; (defun pjk-DynSetVar (assoclst) (mapcar (function (lambda (x)(set (read (car x)) (cdr x)))) assoclst) ) ;; End Function (pjk-dynsetvar)2 points
-
It seems it's not placing CENTERMARKS in Mechanical, I haven't tested other verticals from the toolset, it does use my fallback CrossHairs, though. I may not bother getting CENTERMARK to work in verticals unless someone else is interested, I would use the LISP in AutoCAD anyway, but I will do some testing on Mechanical/Architectural drawings in AutoCAD when I have time. Speaking of time, does anyone have a LISP or something that can give me a 30+ hour day, maybe @rlx I'll try to check this latest version in AutoCAD 2000i this weekend.2 points
-
@Steven P A couple of suggestions (defun MakeDriveList ( / replace with (if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already (setq drivelist (ah:butts 1 "V" '("Please choose" "C:" "D:" "E:" "F:"))) "(setq GetFolderDcl (load_dialog "GetFolder"))" I use the write dcl to lisp by RLX so dcl code can live in the master lisp, then only one file. You may be able to use powershell to dump out the correct drives including network drives to a file and read that with lisp, done via a (startapp c:\path\drives.bat) powershell Get-PSDrive -PSProvider FileSystem | Out-File -FilePath "D:\acadtemp\drives_list.txt" exit Convert dcl 2 lisp rlx.lsp Multi radio buttons.lsp2 points
-
2 points
-
I work with 2D CAD drawings for protective foam packaging and CNC, so overlapping geometry is something I pay attention to. Duplicate lines can create problems downstream, especially when preparing closed profiles for cutting. I think it's worth teaching beginners to check their geometry early instead of waiting until export.2 points
-
A contrived exercise to demonstrate the performance considerations: (defun foo1 ( lst ) (vl-sort lst (function (lambda ( s1 s2 ) (compare (splitstr s1) (splitstr s2)) ) ) ) ) (defun foo2 ( lst ) (mapcar '(lambda ( n ) (nth n lst)) (vl-sort-i (mapcar 'splitstr lst) 'compare) ) ) (defun compare ( l1 l2 / x y ) (while (and l1 l2 (= (setq x (car l1)) (setq y (car l2)))) (setq l1 (cdr l1) l2 (cdr l2) ) ) (cond ( (null l1)) ( (null l2) nil) ( (and (numberp x) (numberp y)) (< x y) ) ( (numberp x)) ( (numberp y) nil) ( (< (strcase x) (strcase y))) ) ) (defun splitstr ( str ) (read (strcat "(" (vl-list->string (apply 'append (mapcar (function (lambda ( a ) (if (< 47 a 58) (list a) (list 34 a 34) ) ) ) (vl-string->list str) ) ) ) ")" ) ) ) _$ (setq mylist (makelist 100)) ("byo547swd" "niq983ocu" "aca823vdk" "wtq568rur" "phi902niq" "bjh526uzd" "rji359jxn" "qqv937rwf" "tug083pja" "gad189ena" "lte537pir" "laa124lqe" "pjd997nvz" "opt105nif" "lbg559zsq" "tpj226ohq" "jdo941odr" "pyl665lro" "hoi547oxb" "tke599mge" "tqm797yrt" "dlm480ido" "jlt529gio" "dtl751rtz" "lpi310zks" "rit617cpr" "qdf999kec" "lkz260ohj" "xlg106fuk" "dqj592rbs" "rza409lss" "phx280fll" "rft924rac" "xrt327nir" "mil320zdh" "sec951fzz" "hng963son" "bhm360nws" "whv768vre" "sub738cgn" "udp152qpy" "bfv499vpg" "bef375dxu" "sne299abt" "jwg218naf" "kul046lji" "opm274fep" "xqb135wrk" "vug239ccx" "yvk063bnl" "cca701lfg" "upy690bri" "nsj806ovt" "igt413wky" "ftw622pra" "jsm813cre" "fnd378khc" "utk011unn" "hkm488zlv" "naw752kdp" "gze062nrv" "ytt910gzi" "eeq942uez" "rbm719yzv" "adu204kgv" "voo553bzq" "qah335lvg" "oky453mna" "bye070dci" "uwt849qig" "nkg662cbj" "koy546cve" "fgp548fhm" "hxm087okh" "atb056yvr" "jxz680bdn" "ofc383clx" "ran801jgt" "dai951aut" "muc372eji" "dmv843wdj" "mwl251acq" "skn266edb" "stz033eih" "qbm300sjp" "tax196nfk" "uix079eqf" "evl716cui" "tjl236dov" "mod149kqp" "cai814mxb" "yyf245cfk" "occ503uit" "csd182gul" "jgs728fmy" "hga698aqi" "hfk752ize" "vra872olq" "bjm266zaq" "zva674kji") _$ (foo1 mylist) ("aca823vdk" "adu204kgv" "atb056yvr" "bef375dxu" "bfv499vpg" "bhm360nws" "bjh526uzd" "bjm266zaq" "bye070dci" "byo547swd" "cai814mxb" "cca701lfg" "csd182gul" "dai951aut" "dlm480ido" "dmv843wdj" "dqj592rbs" "dtl751rtz" "eeq942uez" "evl716cui" "fgp548fhm" "fnd378khc" "ftw622pra" "gad189ena" "gze062nrv" "hfk752ize" "hga698aqi" "hkm488zlv" "hng963son" "hoi547oxb" "hxm087okh" "igt413wky" "jdo941odr" "jgs728fmy" "jlt529gio" "jsm813cre" "jwg218naf" "jxz680bdn" "koy546cve" "kul046lji" "laa124lqe" "lbg559zsq" "lkz260ohj" "lpi310zks" "lte537pir" "mil320zdh" "mod149kqp" "muc372eji" "mwl251acq" "naw752kdp" "niq983ocu" "nkg662cbj" "nsj806ovt" "occ503uit" "ofc383clx" "oky453mna" "opm274fep" "opt105nif" "phi902niq" "phx280fll" "pjd997nvz" "pyl665lro" "qah335lvg" "qbm300sjp" "qdf999kec" "qqv937rwf" "ran801jgt" "rbm719yzv" "rft924rac" "rit617cpr" "rji359jxn" "rza409lss" "sec951fzz" "skn266edb" "sne299abt" "stz033eih" "sub738cgn" "tax196nfk" "tjl236dov" "tke599mge" "tpj226ohq" "tqm797yrt" "tug083pja" "udp152qpy" "uix079eqf" "upy690bri" "utk011unn" "uwt849qig" "voo553bzq" "vra872olq" "vug239ccx" "whv768vre" "wtq568rur" "xlg106fuk" "xqb135wrk" "xrt327nir" "ytt910gzi" "yvk063bnl" "yyf245cfk" "zva674kji") _$ (foo2 mylist) ("aca823vdk" "adu204kgv" "atb056yvr" "bef375dxu" "bfv499vpg" "bhm360nws" "bjh526uzd" "bjm266zaq" "bye070dci" "byo547swd" "cai814mxb" "cca701lfg" "csd182gul" "dai951aut" "dlm480ido" "dmv843wdj" "dqj592rbs" "dtl751rtz" "eeq942uez" "evl716cui" "fgp548fhm" "fnd378khc" "ftw622pra" "gad189ena" "gze062nrv" "hfk752ize" "hga698aqi" "hkm488zlv" "hng963son" "hoi547oxb" "hxm087okh" "igt413wky" "jdo941odr" "jgs728fmy" "jlt529gio" "jsm813cre" "jwg218naf" "jxz680bdn" "koy546cve" "kul046lji" "laa124lqe" "lbg559zsq" "lkz260ohj" "lpi310zks" "lte537pir" "mil320zdh" "mod149kqp" "muc372eji" "mwl251acq" "naw752kdp" "niq983ocu" "nkg662cbj" "nsj806ovt" "occ503uit" "ofc383clx" "oky453mna" "opm274fep" "opt105nif" "phi902niq" "phx280fll" "pjd997nvz" "pyl665lro" "qah335lvg" "qbm300sjp" "qdf999kec" "qqv937rwf" "ran801jgt" "rbm719yzv" "rft924rac" "rit617cpr" "rji359jxn" "rza409lss" "sec951fzz" "skn266edb" "sne299abt" "stz033eih" "sub738cgn" "tax196nfk" "tjl236dov" "tke599mge" "tpj226ohq" "tqm797yrt" "tug083pja" "udp152qpy" "uix079eqf" "upy690bri" "utk011unn" "uwt849qig" "voo553bzq" "vra872olq" "vug239ccx" "whv768vre" "wtq568rur" "xlg106fuk" "xqb135wrk" "xrt327nir" "ytt910gzi" "yvk063bnl" "yyf245cfk" "zva674kji") _$ (equal (foo1 mylist) (foo2 mylist)) T _$ (benchmark '((foo1 mylist) (foo2 mylist))) Benchmarking ..........Elapsed milliseconds / relative speed for 128 iteration(s): (FOO2 MYLIST).....1953 / 4.84 <fastest> (FOO1 MYLIST).....9453 / 1.00 <slowest>1 point
-
Did something similar for vehicle driveway checking, just a maybe make the box like 2mm smaller than true size and position and rotate, use intersectwith to see if the box and walls touch you will get nil if they dont.touch. Say stop when get points.1 point
-
@Discus84 Your question reminded me of the time my son asked me if I could determine if the couch he was planning to buy would fit in the frieght elevator of his aprtment building. There are several way to solove this problem. 1. Make multiple copies of the red box at different angles and then position them with object snap against the walls and floor. 2. Use the paramteric feature of AutoCAD to create and constrain the wall and the box. The following image shows only the angle contraint of the box. Tangency to the wall and floor is made via a dimensional contraint. Here's the result of changing the box angle. The following shows the dimensional and geometric constraints. Note, d3 constrains the box to be flush with the back wall and d9 with the floor. You can edit the dimensions in the attached file to meet yout requirements. box fit.dwg1 point
-
Great question! This is a classic challenge when working with meshes in AutoCAD. When you increase the smoothness level globally, it acts like a blanket smoothing filter and ruins hard edges. To keep sharp features intact, here are a few approaches depending on the model: Creasing Edges (MESHSMOOTHCREASE): Before increasing smoothness, you can apply creases to specific edges or vertices. This tells AutoCAD to hold those edges sharp even at higher subdivision levels. Selective Refinement: Instead of cranking up the global smoothness for the whole object, try refining only specific faces or sub-objects where smooth transitions are actually needed, leaving critical mechanical features alone. Hybrid Modeling: If precise dimensions and sharp intersections are critical (like for manufacturing components), I usually avoid heavy mesh editing and stick to solid modeling, or convert the final clean shape back to solids using CONVTOSOLID once the organic parts are done. How complex is the geometry you're working on? Are you dealing with mechanical parts or more of an architectural/organic shape?1 point
-
@PGia there are other ways to sort lists other than inbuilt Vl-sort. You can use a Lisp version of Bubble sort and other sort algorithms. I sort up to 5 items deep in a list and as far as I can tell none are lost. Yes have seen that with some lists using VL-sort. So you can sort on say X & Y. ; sorts on 1st two items (vl-sort lst '(lambda (a b) (cond ((< (car a) (car b))) ((= (car a) (car b)) (< (cadr a) (cadr b))) ) ) )1 point
-
@Danielm103 Interesting. I didn't know about those functions or that a parallel namespace existed. I'll look into that. Maybe it will minimize the drawbacks of using dynamic variables. @BIGAL Suppose we're dealing with elements that are scattered over a large area and you need to sort only a part of them and get a list. It might seem that the vl-sort function could be useful for this; however, it has a drawback: sometimes it deletes repeated elements from the list based on the filters. So I'm trying to do it without using vl-sort. Note: There are some objects that match exactly in location with others. @mhupp: Dictionary? What dictionary?1 point
-
1 point
-
I get that @PGia but it almost be harder to recall the correct random variable. associated list might not be what you need with the large data set your working with. as assoc looks at all 20000 records every time. look into Dictionary before going the other route. alot faster searching because you can only have unique keys tho that might be a deal breaker for you.1 point
-
There may be ways to speed up using a list of 20,000 points, the first is if your points are numbered then make the list that way you have to but pt number 0 as 1st item then a (nth x lst) is a simple task and does not need the (- x 1). Re find a point depending how the list is made there is a way of quickly finding the point based on a sorted list a 10,000 list takes 13 tries to find the correct answer, it uses a 1/2 algorithm, look at 5000 item is it before or after look at say 2500 is it before or after so very fast. Can you explain what it is your doing and maybe some people here can provide faster code. I know something I did took 34 minutes 1st go, it now takes 2 minutes including user input.1 point
-
Here is my latest zoom .9x in all layouts. I hadn't noticed the OP posted a .dwg, so i ran my Viewport Border into Model code on it. Is the result you wanted? ====================================== AutoVPBrdr REPORT ====================================== True layout viewports: 4 Viewport layer assignments: 4 Layer assignment failures: 0 Modelspace borders created: 3 Viewports skipped: 1 -------------------------------------- Layer: Viewport Color: 45 Plot: OFF ====================================== ZE_Z9XP_1.1.lsp1 point
-
Frustratingly I think it has a couple of VLAX functions but not all of them - for LT I'd be finding another way if possible (in my example above bypassing the functionality completely)1 point
-
@BIGAL you're correct...in fact functions attempting to access 3rd party apps like Excel are all not supported: https://help.autodesk.com/view/ACDLT/2024/ENU/?guid=GUID-037BF4D4-755E-4A5C-8136-80E85CCEDF3E1 point
-
The other important one missing is Vlax-get-application it allows you to talk to Excel via lisp.1 point
-
@indiancad here's a thread that you might find interesting regarding twist relative to a spline. Note that the first derivative of a curve is a vector tangent to the spline at a specifed point on the spline. The second derivative is a vector thet is the direction and magnitude of the change in the tangent vector at a point. The cross product of these two vetors, also know as the transverse vector, point to the instantaneous center of curvature for the curve at a specfied point along a curve. I wrote the following program to display graphically the radius of curvature (the ends of the generated lines are the center of curvature) or the curvature of a spline (short lines indicate almost flat segments of a spline). Try the program on a spline and answer Yes when prompted. (defun C:DOCL (/ path inc n osm par der1 der2 curva p perp normv p2 sf curveType ans) ; = Degree Of Curvature - Lines ; Creates curvature lines or radius-of-curvature lines ; normal to a spline. ; LRM 8/18/2022 edited to place curvature vectors outside (setq path (car (entsel)) inc (/ (vlax-curve-getEndParam path) 100) n 0 osm (getvar 'osmode) ) (setvar 'osmode 0) (setvar "cmdecho" 0) (initget "y n") (setq ans (getkword "Do you want radius-of-curvature instead of curvature? [y/n] <n>: ")) (if (= ans "y") (setq curveType 1) (setq curveType 2 sf (getdist "Enter scale factor.") ) ) (repeat 100 (setq par (* inc n)) (setq der1 (vlax-curve-getfirstDeriv path par) der2 (vlax-curve-getSecondDeriv path par) ) ; calculate curvature at point par (setq d (distance '(0 0 0) (cross der1 der2))) (if (> (abs d) 1.0e-15) (progn (setq curva (/ (expt (distance '(0 0 0) der1) 3) d)) (if (= curveType 2) (setq curva (* -1. (* sf (/ 1. curva)))) ) (princ "\n") (princ n) (princ " curvature = ") (princ curva) (setq p (vlax-curve-getPointAtParam path par) perp (unitv (cross der1 (cross der2 der1))) normv (mapcar '* perp (list curva curva curva)) p2 (mapcar '+ p normv) ) (command "_.line" p p2 "") ) ; end progn ) (setq n (1+ n)) ) (setvar 'osmode osm) (setvar "cmdecho" 1) (princ) ) ;;; Compute the cross product of 2 vectors a and b (defun cross (a b / crs) (setq crs (list (- (* (nth 1 a) (nth 2 b)) (* (nth 1 b) (nth 2 a)) ) (- (* (nth 0 b) (nth 2 a)) (* (nth 0 a) (nth 2 b)) ) (- (* (nth 0 a) (nth 1 b)) (* (nth 0 b) (nth 1 a)) ) ) ;end list ) ;end setq c ) ;end cross (defun unitV ( v / d) (setq d (distance '(0 0 0) v) d (mapcar '/ v (list d d d)))) blocks_on_spline.lsp spline curvature.lsp1 point
-
FYI: LT 2024+ does support vlax functions but not vlax-create-object1 point
-
Besides checking the related settings, I have had to rotate and position the shape as well, though most of my SWEEP experience is with piping, so no worries if a circle twists.1 point
-
I still try to think about LT usage when redoing an old LISP and creating new LISP, but it's not a real priority. If those that use LT around here need something done with a LISP and we can't find one that runs on LT, I can see if it's adjustable to be made to work or I can just do it for them. I originally asked this because an engineer with AutoCAD LT needed to convert a bunch of DGNs, I did end up converting a lot of folders with my LISP, but in the end the company that sent us the DGNs sent the exported from Autoplant .dwgs, etc., the DGNs we had converted okay, but IIRC some information was missing here and there for some of the files.1 point
-
I was looking for something quick and simple yesterday - thanks. Now the not so quick part, I decided to make the DCL file as 'create on demand' style, and then tweak it a touch.... and then sent it through Al... a bit updated does what I want now. (Al was reasonably competent in it saved me about an hour copy-paste from my reference LISPs) Edit: Oh, for LT... forgetting the reason I was looking - shortcut links use VLAX code and I think the desktop part needs amending too - shortcuts are bypassed - won't work in LT - desktop I'll come back to (defun c:gf ( / DriveList CurDrive SubfolderList CurSubfolder GetFolderOldErr GetFolderDcl CurPath PathHistoryList MyResult) (defun GetFolder_init ( / MyDrawingDrive ) (setq GetFolderDcl (load_dialog "GetFolder")) (setq GetFolderOldErr *error*) (setq *error* GetFolderErr) (MakeDriveList) (setq CurPath (getvar "DWGPREFIX")) ;; Current drawing folder (setq DrawingDrive (substr CurPath 1 2)) ;; Drive (setq CurDrive (vl-position DrawingDrive DriveList)) (if (null CurDrive) (setq CurDrive 0)) ; End If (setq PathHistoryList (list CurPath)) (MakeSubfolderList CurPath) ) ; End GetFolder_init (defun GetFolder_exit ( / ) (setq CurPath CurPath) ) ; End GetFolder_exit (defun GetFolderErr ( s / ) (GetFolder_exit) (if GetFolderOldErr (setq *error* GetFolderOldErr) (setq *error* '()) ) ; End If ) ; End GetFolderErr (defun MakeDriveList ( / ascii-code drive ) (setq DriveList '()) (setq ascii-code 67) ;; ASCII code C = 67, Z = 90 (while (<= ascii-code 90) (setq drive (strcat (chr ascii-code) ":") ) (if (vl-file-directory-p drive) (setq DriveList (append DriveList (list drive))) ) ; End If (setq ascii-code (1+ ascii-code)) ) ; End While ) ; End MakeDriveList (defun MakeSubfolderList ( dir / MyFolderList MyShortcutList ) (if (and dir (= (type dir) 'STR) (vl-file-directory-p dir) ) ; End And (progn (setq MyFolderList (vl-directory-files dir nil -1) ) ;; Folders (if (= (getvar 'program) "LT") (setq SubfolderList (append (list "<-") MyFolderList )) ;;LT vl-dirctoryfiles might not work (progn (setq MyShortcutList (vl-directory-files dir "*.lnk" 1) ) ;; Shortcuts (setq SubfolderList (append (list "<-") MyFolderList MyShortcutList )) ) ; end progn ) ; end if ) ; End Progn (setq SubfolderList (list "<-")) ) ; End If (setq SubfolderList (vl-remove "." SubfolderList) ) (setq SubfolderList (vl-remove ".." SubfolderList)) (if (wcmatch CurPath "@`:") (setq SubfolderList (vl-remove "<-" SubfolderList)) ) ; End If ) ; End MakeSubfolderList (defun UpdateSubfolder ( $value / MyShortcut MyTarget MyShell ) (setq CurSubfolder (nth (atoi $value) SubfolderList )) (cond ((equal CurSubfolder "<-") ;; Back to previous folder (if (= (length PathHistoryList) 1) ;; top level (progn (setq CurPath (car PathHistoryList)) ) (progn (setq CurPath (cadr PathHistoryList)) (setq PathHistoryList (cdr PathHistoryList)) ) ; end progn ) ; end if ) ; end cond ((wcmatch (strcase CurSubfolder) "*.LNK") ;; shortcut (if (= (getvar 'program) "LT") ;; LT doesn't do VLAX (progn ) (progn (setq MyShell (vlax-create-object "WScript.Shell")) (setq MyShortcut (vlax-invoke-method MyShell 'CreateShortcut (strcat CurPath "\\" CurSubfolder))) (setq MyTarget (vlax-get-property MyShortcut 'TargetPath)) (vlax-release-object MyShortcut) (vlax-release-object MyShell) (if (and ;; if lnk is a folder MyTarget (vl-file-directory-p MyTarget) ) ; End And (progn (setq PathHistoryList (append (list CurPath) PathHistoryList )) (setq CurPath MyTarget) ;; Jump to shortcut target ) ; End Progn ;; (alert "Shortcut does not point to a folder.") ) ; End If ) ; end progn lnk ) ; end if ) ; end cond (T ;; Normal folder (setq PathHistoryList (append (list CurPath) PathHistoryList )) (setq CurPath (strcat CurPath "\\" CurSubfolder) ) ;; Enter selected folder ) ; end cond T ) ; End Conds (MakeSubfolderList CurPath) ;; Rebuild folders and shortcuts for the new location ;; Replace existing DCL list contents (start_list "subfolder" 3) (mapcar 'add_list SubfolderList) (end_list) (set_tile "subfolder" "0") ;; Select first item in refreshed list (set_tile "path" CurPath) ;; Display new path ) ; End UpdateSubfolder (defun InitDialog ( / ) (start_list "drive") (mapcar 'add_list DriveList) (end_list) (set_tile "drive" (itoa CurDrive)) ;; Select the drive containing the current drawing (start_list "subfolder") (mapcar 'add_list SubfolderList) (end_list) (set_tile "path" CurPath) ;; Display the current drawing folder ) ; End InitDialog (defun GetFolder_dialog ( / fname GF drv MyDclFile dcl_id MyFile) ;; Create DCL file ;;Start DCL (setq GF (open (setq fname (vl-filename-mktemp "GetFolder" (getvar "TEMPPREFIX") ".dcl")) "w")) ;;Header (write-line "SelLays : dialog {" GF) (write-line " key = \"Folder\";" GF) (write-line " label = \"GetFolder (RLX-10/04)\";" GF) (write-line " spacer;" GF) ;;Stuff (write-line " :row {alignment = top;" GF) (write-line " :column { width = 5; fixed_width = true; " GF) (write-line " : popup_list {key = \"drive\"; label = \"Drive\"; edit_width = 7; }" GF) (write-line " }" GF) ; end column (write-line " :column { width = 38; fixed_width = true; " GF) (write-line " }" GF) ; end column (write-line " }" GF) ; end row (write-line " :row {alignment = top;" GF) (write-line " :column { width = 6; fixed_width = true; " GF) (write-line " }" GF) ; end column (write-line " :column { width = 12; fixed_width = true; " GF) (write-line " :row {alignment = top;" GF) (write-line " : button { key = \"uplevel\"; label = \"↑ Last level\"; width = 5; }" GF) (write-line " : button { key = \"desktop\"; label = \"Desktop\"; width = 5; }" GF) (write-line " }" GF) ; end row (write-line " }" GF) ; end column (write-line " :column { width = 32; fixed_width = true; " GF) (write-line " }" GF) ; end column (write-line " }" GF) ; end row (write-line " :row {alignment = top;" GF) (write-line " : list_box { key = \"subfolder\"; label = \"Subfolders\"; height = 12; width = 25; }" GF) (write-line " }" GF) ; end row (write-line " :row {alignment = top;" GF) (write-line " : edit_box { key = \"path\"; label = \"Path\"; width = 25; }" GF) (write-line " }" GF) ; end row (write-line " ok_cancel;" GF) (write-line "}" GF) ; end dialog (close GF) (setq dcl_id (load_dialog fname)) (if (and dcl_id (new_dialog "SelLays" dcl_id) ) ; End And (progn (InitDialog) (action_tile "drive" " (UpdateDrive $value)" ) (action_tile "desktop" "(UpdateDesktop)" ) (action_tile "uplevel" "(UpdateUpLevel)" ) (action_tile "subfolder" "(UpdateSubfolder $value)" ) (action_tile "path" "(UpdatePath $value)" ) (action_tile "accept" "(done_dialog 1)" ) (action_tile "cancel" "(done_dialog 0)" ) (setq drv (start_dialog)) (cond ((= drv 0) (setq CurPath nil) ) ((= drv 1) (setq CurPath CurPath) ) ) ; End Cond ) ; End Progn ) ; End If (if dcl_id (unload_dialog dcl_id) ) ) ; End GetFolder_dialog (defun UpdateDrive ( $value / ) (setq CurDrive (atoi $value) ) (setq CurPath (nth CurDrive DriveList) ) (MakeSubfolderList CurPath) (start_list "subfolder") (mapcar 'add_list SubfolderList) (end_list) (setq PathHistoryList (list CurPath) ) (set_tile "path" CurPath) ) ; End UpdateDrive (defun UpdatePath ( dir / ) (if (and dir (= (type dir) 'STR) (vl-file-directory-p dir) ) ; End And (setq CurPath dir) (alert "Invalid Path") ) ; End If ) ; End UpdatePath (defun UpdateUpLevel ( / MyParentPath ) ;; Remove trailing slash if present (if (or (= (substr CurPath (strlen CurPath) 1) "\\") (= (substr CurPath (strlen CurPath) 1) "/") ) ; Endor (setq CurPath (substr CurPath 1 (1- (strlen CurPath))) ) ) ; End If (setq MyParentPath (vl-filename-directory CurPath)) ;; parent folder (if MyParentPath (progn (setq CurPath MyParentPath) (MakeSubfolderList CurPath) ;; Refresh subfolder list (start_list "subfolder") (mapcar 'add_list SubfolderList) (end_list) (set_tile "path" CurPath) ;; Update displayed path (setq PathHistoryList (list CurPath)) ;; Reset history from new location ) ; End Progn ) ; End If ) ; End UpdateUpLevel (defun UpdateDesktop ( / MyShell MyDesktop ) ;;Double check for none VLAX for LT (if (= (getvar 'program) "LT") (progn ) (progn (setq MyShell (vlax-create-object "WScript.Shell") ) (setq MyDesktop (vlax-invoke-method (vlax-get-property MyShell 'SpecialFolders) 'Item "Desktop")) (vlax-release-object MyShell) ) ) (if (and MyDesktop (vl-file-directory-p MyDesktop) ) ; End And (progn (setq CurPath MyDesktop) (MakeSubfolderList CurPath) (start_list "subfolder") (mapcar 'add_list SubfolderList) (end_list) (set_tile "path" CurPath) (setq PathHistoryList (list CurPath)) ) ; End Progn (alert "Desktop folder not found.") ) ; End If ) (GetFolder_init) (GetFolder_dialog) (setq MyResult (GetFolder_exit)) MyResult )1 point
-
That depends on the LISP. Check my GETLEN.lsp. as an example. A new get length LISP - AutoLISP, Visual LISP & DCL - AutoCAD Forums It gets perimeters and accounts for gaps and overlaps even in anonymous blocks. I made that due to SOLPROF profiles being a pain with the overlaps, etc.. So, sometimes a cleanup isn't required to get correct information, just a LISP or other code. I have one somewhere, but there are a few online "OVERKILL" type LISPs that work on blocks and sometimes better cleanup, something OVERKILL doesn't do all of the time. But, OVERKILL does under normal circumstances do fairly well, so a first run with that, or a second run if the drawing needs a real flattening, best to do that first. The waterjet/plasma cutter person at work does a lot of the work for those machines now, but I used to do all of it when those were first purchased. So I have done lots of cleanups for cutting. Luckily, most things I start are pretty clean except the SOLPROF and SOLVIEW/SOLDRAW objects. The software that came with the waterjet also can do some cleaning. So I have that as well.1 point
-
Create sections (green) at several points along the object. Explode the sections then set a UCS to the plane of a section and create offset curves (red) with a distance equal to the desired fillet radius. I used 0.2. Add a circle of the fillet radus at the intersection of the offset curves and then trim the circle. Create a polyline (yelllow) to form a closed shape that includes the "fillet" arc (cyan). With pedit create closed polylines for the fillet sections then use loft to create the fillet solid. Union the two solids together.1 point
-
In the draw window it's for multi story buildings so size can be different for every window. There is not a problem matching properties with a dcl. You can make better descriptions, in the code is default values you set or it can remember previous values. Just have the tools to make the dcl. If you look at the window DCL in movie on right side is edge controls these do just that a corner or a multi panel join and so on. So in your comments you talk a bit about this. Yes it's drawn via objects Plines etc. You can have shapes like the V notch. The dimensioning is just part of a program. I believe it will be easier than trying to make a dynamic block work. Given how much post time has occurred in this forum, a program would be done by now. But it is for your company only so a cost may be relevant. But you can add more shapes quickly. Will see if can find time to do some form of example. Step 11 point
-
Here's another without command calls: (defun c:zal (/ a d c tabs) ;; RJP » 2020-07-08 (setq c (getvar 'ctab)) (vlax-for x (vla-get-layouts (setq d (vla-get-activedocument (setq a (vlax-get-acad-object))))) (setq tabs (cons (list (vla-get-name x) (vla-get-taborder x)) tabs)) ) ;; The sort makes sure that the tabs step left to right (foreach x (cdr (vl-sort tabs '(lambda (r j) (< (cadr r) (cadr j))))) (setvar 'ctab (car x)) (vlax-put d 'mspace 0) (vla-zoomextents a) ) (setvar 'ctab c) (princ) )1 point
-
1 point
-
1 point
-
1 point
-
Just added this to the link from SLW210, below modified to select many dimensions. Note the entity to dimension to are lines just now, should work with other entities, just change that line, (defun c:reass ( / DimEnt MyDim Pta Ptb EndA EndB EndA_Lines EndB_Lines) (if (setq ss (ssget '((0 . "DIMENSION")) )) ; select dimensions (repeat (setq i (sslength ss)) ; loop through selection set (setq DimEnt (ssname ss (setq i (1- i)))) (command "_zoom" "O" DimEnt "") (setq MyDim (entget DimEnt)) (setq Pta (cdr (assoc 13 MyDim))) (setq Ptb (cdr (assoc 14 MyDim))) (setq EndA_Lines (ssget "_C" (mapcar '+ Pta (mapcar '/ Pta '(1000 1000 1000))) (mapcar '- Pta (mapcar '/ Pta '(1000 1000 1000))) '((0 . "LINE")) )) ; select entity close to end of dimension line (setq EndB_Lines (ssget "_C" (mapcar '+ Ptb (mapcar '/ Pta '(1000 1000 1000))) (mapcar '- Ptb (mapcar '/ Pta '(1000 1000 1000))) '((0 . "LINE")) )) ; select entity close to end of dimension line ; (command "dimreassociate" DimEnt "" "end" Pta "end" Ptb) (if EndA_Lines (command "dimreassociate" DimEnt "" "end" Pta "")) (if EndB_Lines (command "dimreassociate" DimEnt "" "end" "" "end" Ptb )) (command "_zoom" "previous") ) ; end repeat ) ; end if (princ) ; end quietly )1 point
