Recent Posts

Pages: [1] 2 3 ... 10
1
.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
2
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)
    )
     
3
.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.
4
.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:
5
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.

6
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.
7
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
8
AutoLISP (Vanilla / Visual) / Re: Attribute Text Width
« Last post by Lastknownuser on May 09, 2024, 04:24:32 AM »
There is nothing special in the drawing file or template.

My starting point is an example in the ActiveX section in HELP showed below.
I have no idea to redefine the "oML" in my case by given a title block "BLK-01" and an attribute "ATT-01" based on multi page drawing.

I'd like to learn this method.
Thanks.

Code: [Select]
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
 
    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))
   
    (vla-put-TextWidth oML 7.4)
)

Your case is a different thing compared to code attached. If you want to do it with visual lisp (vla), you have to get Attribute Reference ATT-01 of the block BLK-01 and change its width using vla-put-scalefactor.
9
.NET / PropertySetDefinition with a List data type
« Last post by Jeff_M on May 08, 2024, 07:06:09 PM »
I have a tool for displaying and editing PropertySets which was working well until we added a definition with a List data type. I can get the list but I need to show it in a DataTable. I define the column as a DataType.List but have been unable to figure out how to actually use it in the table. When I add it when filling the table it just shows up as (Collection) but I need it to show the actual PropertySet current value. I had also thought that by using the List datatype the list would be shown as a dropdown to select another item in the list.
To save the List column data I use a Dictionary since there may be mor than one column of this type:
Code - C#: [Select]
  1.             var listDictionary = new Dictionary<string, List<string>>();
  2.  
As I loop through the definitions to create the columns I get the Name and the actual list of items:
Code - C#: [Select]
  1.  case Autodesk.Aec.PropertyData.DataType.List:
  2.      dtype = typeof(List<string>);
  3.      var thelist = (AEC.ListDefinition)prop.ListDefinitionId.Open(OpenMode.ForRead);
  4.      var items = thelist.GetListItems();
  5.      var dataList = new List<string>();
  6.      foreach (ObjectId item in items)
  7.      {
  8.          var j = (AEC.ListItem)item.Open(OpenMode.ForRead);
  9.          dataList.Add(j.Name);
  10.      }
  11.      listDictionary.Add(prop.Name, dataList);
  12.      break;
Then, when I get the actual PropertySet data assigned to an object fill the table rows:
Code - C#: [Select]
  1.                                 foreach (string s in GetPropDefs(property))
  2.                                 {
  3.                                     var d = propset.GetAt(propset.PropertyNameToId(s));
  4.                                     if (theTable.Columns[s].DataType == typeof(List<string>))
  5.                                     {
  6.                                         List<string> dd = listDictionary[s];
  7.                                         row[s] = dd; //How to display the actual value of s which is a member of the list?
  8.                                         continue;
  9.                                     }
  10.                                     row[s] = d; //This works for DataTypes int, double, string, and bool
  11.                                 }
  12.  
If I make the Column for the List as a string type, I can just assign the PropertySet Value, but then the list is ignored.

I'm drawing a blank on how to implement this. A Google search gives all kinds of answers on how to create the DataTable from a list but nothing on how to use a list with a DataType.List cell.
10
AutoLISP (Vanilla / Visual) / Re: Modifying Alignment to Profile View help
« Last post by MSTG007 on May 08, 2024, 12:59:15 PM »
I got another one for you within this. I was hoping to Select the Profile View to Grab the Alignment. However, with this setup, I have to pick the alignment first. Then it will select all the Civil3D PN parts and the PressureN Parts, and place them into the selected profile view. I was trying to use the original selection set and apply it to both these commands (AddNetworkPartsToProf, AddPressurePartsToProf). Not having much luck. Any ideas?



Code: [Select]
(defun c:PN2PV (/ add ss i e l d g lst s n alignEnt alignObj startSta endSta)
  (setq add (ssadd))
  (princ "\nSelect Alignment: ")
  (if (setq ss (ssget '((0 . "AECC_ALIGNMENT"))))
      (progn
        ;; If selection set is not empty
        (repeat (setq i (sslength ss))
          (setq e (ssname ss (setq i (1- i)))
                l (vlax-curve-getdistatpoint e (vlax-curve-getendpoint e))
                d (/ l 300.)
                g d
                lst nil)
          (repeat 300
            (setq lst (cons (vlax-curve-getpointatdist e g) lst)
                  g (+ g d)))
          (setq lst (append lst (list (vlax-curve-getstartpoint e))))
          (if (setq s (ssget "_F" lst '((0 . "AECC_STRUCTURE,AECC_PIPE,AECC_PRESSUREPIPE,AECC_FITTING,AECC_APPURTENANCE"))))
              (repeat (setq n (sslength s))
                (ssadd (ssname s (setq n (1- n))) add))))
       
        (sssetfirst nil add)
        (command "AddNetworkPartsToProf"))

          (if (setq s (ssget "_F" lst '((0 . "AECC_STRUCTURE,AECC_PIPE,AECC_PRESSUREPIPE,AECC_FITTING,AECC_APPURTENANCE"))))
              (repeat (setq n (sslength s))
                (ssadd (ssname s (setq n (1- n))) add))))

        (sssetfirst nil add)
        (command "AddPressurePartsToProf"))
     
      (princ "\nNo entities selected."))
  (princ))
Pages: [1] 2 3 ... 10