Recent Posts

Pages: [1] 2 3 ... 10
1
CAD General / Re: Batch Find & Replace Text AutoCAD 2023
« Last post by Lee Mac on Today at 12:46:23 PM »
Try setting LISPSYS to 0.
2
AutoLISP (Vanilla / Visual) / Re: 3d polyline splitting
« Last post by ribarm on Today at 10:52:29 AM »
@mariolino0099
I've fixed (while) endless loop, but it doesn't follow exact math because segments lengths are less than 0.7 units, so if I divide it with 0.7 and (fix) that number I get 0 - which gives another error - divide by zero... So, I had to include one (if) statement that will ensure that your first *.DWG is processed correctly with verices numbers like you presented on right side 3d polyline, and your second *.DWG is processed with that second - else (if) statement (setq n (fix (1+ (/ dd d)))) ... That 1+ is to ensure that divide by zero doesn't occur...
So, test my codes now, as I think that better than this is not neccessary...
4
.NET / Re: Using the Generic KeyValuePair<>
« Last post by retsameht on Today at 05:38:04 AM »
Just a heads up: Don't use the code in this file until I fix it:

https://github.com/ActivistInvestor/AcMgdUtility/blob/main/DocumentCollectionExtensions.cs

UPDATE 5/10/24: Bugs fixed (WaitForIdle(), and WaitUntil() were hanging AutoCAD :oops:).

WaitForIdle() is a solution to a problem that has irked me for a long time (handling the next Application.Idle event). I had previously addressed it by using a class that wraps the handler for the event, but that still required the code to be run in the Idle event handler to be passed in a delegate.

WaitForIdle() is a far-better solution that requires nothing but an awaited method call, followed by the code that should run after the Idle event is raised.

Code - C#: [Select]
  1. /// WaitForIdle():
  2.  
  3. public static async void MyMethod()
  4. {
  5.    var DocMgr = Application.DocumentManager;
  6.    
  7.    // wait for an Idle event to be raised:
  8.    
  9.    await DocMgr.WaitForIdle();
  10.    
  11.    // Code appearing here will not run until
  12.    // the next Idle event is raised and there
  13.    // is an active document.
  14.    
  15.    var doc = DocMgr.MdiActiveDocument;      
  16.    doc.Editor.WriteMessage("An Idle event was raised.");
  17. }
  18.  
  19.  
  20. /// WaitUntil():
  21.  
  22. public static async void MyMethod()
  23. {
  24.    var DocMgr = Application.DocumentManager;
  25.    
  26.    // Waits until there is an active document
  27.    // that is in a quiescent state:
  28.    
  29.    await DocMgr.WaitUntil(doc => doc.Editor.IsQuiescent);
  30.    
  31.    // Code appearing here will not run until
  32.    // the next Idle event is raised; there is
  33.    // an active document; and that document
  34.    // is in a quiescent state.
  35.    
  36.    var doc = DocMgr.MdiActiveDocument;      
  37.    doc.Editor.WriteMessage("The Drawing Editor is quiescent");
  38. }
  39.  
  40.  
5
AutoLISP (Vanilla / Visual) / Re: 3d polyline splitting
« Last post by mariolino0099 on Today at 02:37:53 AM »
hello ribarm
thanks for the help, i edited the line first
  (if (setq s (ssget "_.+:E:S" (list (cons 0 "POLYLINE") (cons -4 "<or") (cons 70 8) (cons 70 9) (cons -4 "or>"))))
because it was going to error.
For the four-vertex 3dpoly works, in the more complicated case (example_1.dwg) it seems to going inside a infinite loop...
Am I doing something wrong ?
Is possible to select multiple 3dpoly ?

Thnaks



Code: [Select]
    (defun c:split3dpolysegs ( / *error* getvertices unit d cmd uf s plx pl vl a b dd n sd nvl k )
     
      (or (not (vl-catch-all-error-p (vl-catch-all-apply (function vlax-get-acad-object) nil))) (vl-load-com))
     
      (defun *error* ( m )
        (if uf
          (if command-s
            (command-s "_.UCS" "_P")
            (vl-cmdf "_.UCS" "_P")
          )
        )
        (if cmd
          (setvar (quote cmdecho) cmd)
        )
        (if m
          (prompt m)
        )
        (princ)
      )
     
      (defun getvertices ( c / i p plst )
        (setq i -1)
        (while (<= (setq i (1+ i)) (vlax-curve-getendparam c))
          (setq p (vlax-curve-getpointatparam c i))
          (setq plst (cons p plst))
        )
        (reverse plst)
      )
     
      (defun unit ( v / d )
        (if (not (equal (setq d (distance (list 0.0 0.0 0.0) v)) 0.0 1e-6))
          (mapcar (function (lambda ( x ) (/ x d))) v)
        )
      )
     
;      (setq d 1) ;;; initial setting - change to suit your needs ;;;
     
      (setq cmd (getvar (quote cmdecho)))
      (setvar (quote cmdecho) 0)
      (if (= 0 (getvar (quote worlducs)))
        (progn
          (if command-s
            (command-s "_.UCS" "_W")
            (vl-cmdf "_.UCS" "_W")
          )
          (setq uf t)
        )
      )
 
  (initget 7)
  (setq
d (getreal "\nEnter Max Distance between Polyline Vertices : "
)
  )
 
 
      (prompt "\nPick reference 3D polyline...")
      (if (setq s (ssget "_+.:E:S" (list (cons 0 "POLYLINE") (cons -4 "<or") (cons 70 8) (cons 70 9) (cons -4 "or>"))))
        (progn
          (setq plx (entget (setq pl (ssname s 0))))
          (setq vl (getvertices pl))
          (while (setq b (cadr vl))
            (if (< d (setq dd (distance (setq a (car vl)) b)))
              (progn
                (setq n (fix (/ dd d)))
                (setq sd (/ dd n))
                (setq nvl (cons a nvl))
                (setq k 0)
                (repeat n
                  (setq nvl (cons (mapcar (function +) a (mapcar (function *) (unit (mapcar (function -) b a)) (list (* (setq k (1+ k)) sd) (* k sd) (* k sd)))) nvl))
                )
                (setq vl (cdr vl))
              )
            )
          )
          (setq a (car nvl))
          (setq nvl (cdr nvl))
          (if (not (vlax-curve-isclosed pl))
            (setq nvl (cons a nvl))
          )
          (setq nvl (reverse nvl))
          (vl-cmdf "_.3DPOLY")
          (foreach v nvl
            (vl-cmdf "_non" v)
          )
          (if (vlax-curve-isclosed pl)
            (while (< 0 (getvar (quote cmdactive)))
              (vl-cmdf "_C")
            )
            (while (< 0 (getvar (quote cmdactive)))
              (vl-cmdf "")
            )
          )
        )
      )
      (*error* nil)
    )
     
6
.NET / Re: PropertySetDefinition with a List data type
« Last post by Hanauer on May 09, 2024, 04:37:17 PM »
I have been using DataGridViewComboBoxColumn and getting satisfactory results.
If you could post part of the code of the final solution you arrived at, I would be grateful.
7
.NET / Re: PropertySetDefinition with a List data type
« Last post by Jeff_M on May 09, 2024, 03:59:18 PM »
A bit of headway made ... I changed the DataTable column to be a typeof Dictionary<string, List<string>> so I can put the current value as the Key and the List as the value to be used in the DataGrid. However, when the DataGrid columns are auto-generated, the column with the Dictionary is created as a DataGridTextColumn. I think that what I am after is to have that column be a DataGridComboBoxColumn set with the cell set to the value and the selected item set the Key of the dictionary.

I believe I'm on the right track here, just really struggling on how to accomplish it. WPF, MVVM, c#  :uglystupid2:
8
CAD General / Re: Batch Find & Replace Text AutoCAD 2023
« Last post by pablo123 on May 09, 2024, 12:35:47 PM »
I have the same problem as @Evangelos. When I had AutoCad 2017 versions the lisp worked great. After updating AutoCad to 2023 the lisp does not work properly. It is only possible to replace single letters and characters for example: 2 can replace to 55, J can replace to Jacob. It is not possible to replace a longer string of characters than 1. Has anyone managed to solve this problem ? Maybe AutoDesk uses additional security to use paid versions.

9
CAD General / Re: CONTINUOUS line type name in various localizations of AutoCAD
« Last post by ronjonp on May 09, 2024, 11:11:11 AM »
If this is for code, use "_Continuous" and it should not matter.
10
CAD General / CONTINUOUS line type name in various localizations of AutoCAD
« Last post by Vandyck on May 09, 2024, 06:40:47 AM »
Hi
Can anyone tell me the names of the CONTINUOUS line type in the various localizations of AutoCAD?

In Italian, for example, it is "Continua"...
What is the name in German, Spanish, French?

Thank you
Pages: [1] 2 3 ... 10