Recent Posts

Pages: [1] 2 3 ... 10
1
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
2
AutoLISP (Vanilla / Visual) / Re: Attribute Text Width
« Last post by Lastknownuser on Today at 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.
3
.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.
4
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))
5
AutoLISP (Vanilla / Visual) / Re: Check if clip is present in the drawing
« Last post by w64bit on May 08, 2024, 11:43:07 AM »
Thank you.
Is it possible, please, to add an alert when xclips are found?
6
AutoLISP (Vanilla / Visual) / Re: 3d polyline splitting
« Last post by ribarm on May 08, 2024, 09:53:53 AM »
And this code is opposite of splitting by adding vertices... It's called "diet3dp" like my latest with lwpolyline that I coded recently...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:diet3dp ( / *error* unique getvertices collinear-p group_collinear_pts cmd uf s pl plx cf vl nvl gg )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if uf
  6.       (if command-s
  7.         (command-s "_.UCS" "_P")
  8.         (vl-cmdf "_.UCS" "_P")
  9.       )
  10.     )
  11.     (if cmd
  12.       (setvar (quote cmdecho) cmd)
  13.     )
  14.     (if m
  15.       (prompt m)
  16.     )
  17.     (princ)
  18.   )
  19.  
  20.   (defun unique ( lst )
  21.     (if lst
  22.       (cons (car lst)
  23.         (unique
  24.           (vl-remove-if (function (lambda ( x ) (equal x (car lst) 1e-6)))
  25.             (cdr lst)
  26.           )
  27.         )
  28.       )
  29.     )
  30.   )
  31.  
  32.   (defun getvertices ( c / i p ptlst )
  33.     (setq i -1)
  34.     (while (<= (setq i (1+ i)) (vlax-curve-getendparam c))
  35.       (setq p (vlax-curve-getpointatparam c i))
  36.       (setq ptlst (cons p ptlst))
  37.     )
  38.     (reverse ptlst)
  39.   )
  40.  
  41.   (defun collinear-p ( p1 p p2 )
  42.     (and
  43.       (equal (distance p1 p2) (+ (distance p1 p) (distance p p2)) 1e-6)
  44.       (equal (angle p1 p2) (angle p1 p) 1e-6)
  45.       (equal (angle p1 p2) (angle p p2) 1e-6)
  46.     )
  47.   )
  48.  
  49.   (defun group_collinear_pts ( ptlst / a b c g gg )
  50.     (while ptlst
  51.       (setq a (car ptlst) b (cadr ptlst) c (caddr ptlst))
  52.       (while (and c (collinear-p a b c))
  53.         (if (not (vl-position a g))
  54.           (setq g (cons a g))
  55.         )
  56.         (if (not (vl-position b g))
  57.           (setq g (cons b g))
  58.         )
  59.         (if (not (vl-position c g))
  60.           (setq g (cons c g))
  61.         )
  62.         (setq ptlst (cdr ptlst))
  63.         (setq a (car ptlst) b (cadr ptlst) c (caddr ptlst))
  64.       )
  65.       (setq ptlst (cdr ptlst))
  66.       (if g
  67.         (setq gg (cons (reverse g) gg))
  68.       )
  69.       (setq g nil)
  70.     )
  71.     (reverse gg)
  72.   )
  73.  
  74.   (setq cmd (getvar (quote cmdecho)))
  75.   (setvar (quote cmdecho) 0)
  76.   (if (= 0 (getvar (quote worlducs)))
  77.     (progn
  78.       (if command-s
  79.         (command-s "_.UCS" "_W")
  80.         (vl-cmdf "_.UCS" "_W")
  81.       )
  82.       (setq uf t)
  83.     )
  84.   )
  85.   (prompt "\nPick reference 3D polyline...")
  86.   (if (setq s (ssget "_.+:E:S" (list (cons 0 "POLYLINE") (cons -4 "<or") (cons 70 8) (cons 70 9) (cons -4 "or>"))))
  87.     (progn
  88.       (setq plx (entget (setq pl (ssname s 0))))
  89.       (if (= 9 (cdr (assoc 70 plx)))
  90.         (setq cf t)
  91.       )
  92.       (setq vl (getvertices pl))
  93.       (setq nvl vl)
  94.       (setq gg (group_collinear_pts nvl))
  95.       (foreach g gg
  96.         (setq g (cdr g) g (reverse (cdr (reverse g))))
  97.         (foreach p g
  98.           (setq nvl (vl-remove-if (function (lambda ( x ) (equal p x 1e-6))) nvl))
  99.         )
  100.       )
  101.       (if cf
  102.         (setq nvl (reverse (cdr (reverse nvl))))
  103.       )
  104.       (setq nvl (unique nvl))
  105.       (vl-cmdf "_.3DPOLY")
  106.       (foreach v nvl
  107.         (vl-cmdf "_non" v)
  108.       )
  109.       (if cf
  110.         (while (< 0 (getvar (quote cmdactive)))
  111.           (vl-cmdf "_C")
  112.         )
  113.         (while (< 0 (getvar (quote cmdactive)))
  114.           (vl-cmdf "")
  115.         )
  116.       )
  117.     )
  118.   )
  119.   (*error* nil)
  120. )
  121.  

HTH.
M.R.
7
AutoLISP (Vanilla / Visual) / Re: 3d polyline splitting
« Last post by ribarm on May 08, 2024, 09:16:36 AM »
Try this code...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:split3dpolysegs ( / *error* getvertices unit d cmd uf s plx pl vl a b dd n sd nvl k )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if uf
  6.       (if command-s
  7.         (command-s "_.UCS" "_P")
  8.         (vl-cmdf "_.UCS" "_P")
  9.       )
  10.     )
  11.     (if cmd
  12.       (setvar (quote cmdecho) cmd)
  13.     )
  14.     (if m
  15.       (prompt m)
  16.     )
  17.     (princ)
  18.   )
  19.  
  20.   (defun getvertices ( c / i p plst )
  21.     (setq i -1)
  22.     (while (<= (setq i (1+ i)) (vlax-curve-getendparam c))
  23.       (setq p (vlax-curve-getpointatparam c i))
  24.       (setq plst (cons p plst))
  25.     )
  26.     (reverse plst)
  27.   )
  28.  
  29.   (defun unit ( v / d )
  30.     (if (not (equal (setq d (distance (list 0.0 0.0 0.0) v)) 0.0 1e-6))
  31.       (mapcar (function (lambda ( x ) (/ x d))) v)
  32.     )
  33.   )
  34.  
  35.   (setq d 0.7) ;;; initial setting - change to suit your needs ;;;
  36.  
  37.   (setq cmd (getvar (quote cmdecho)))
  38.   (setvar (quote cmdecho) 0)
  39.   (if (= 0 (getvar (quote worlducs)))
  40.     (progn
  41.       (if command-s
  42.         (command-s "_.UCS" "_W")
  43.         (vl-cmdf "_.UCS" "_W")
  44.       )
  45.       (setq uf t)
  46.     )
  47.   )
  48.   (prompt "\nPick reference 3D polyline...")
  49.   (if (setq s (ssget "_.+:E:S" (list (cons 0 "POLYLINE") (cons -4 "<or") (cons 70 8) (cons 70 9) (cons -4 "or>"))))
  50.     (progn
  51.       (setq plx (entget (setq pl (ssname s 0))))
  52.       (setq vl (getvertices pl))
  53.       (while (setq b (cadr vl))
  54.         (if (< d (setq dd (distance (setq a (car vl)) b)))
  55.           (progn
  56.             (setq n (fix (/ dd d)))
  57.             (setq sd (/ dd n))
  58.             (setq nvl (cons a nvl))
  59.             (setq k 0)
  60.             (repeat n
  61.               (setq nvl (cons (mapcar (function +) a (mapcar (function *) (unit (mapcar (function -) b a)) (list (* (setq k (1+ k)) sd) (* k sd) (* k sd)))) nvl))
  62.             )
  63.             (setq vl (cdr vl))
  64.           )
  65.         )
  66.       )
  67.       (setq a (car nvl))
  68.       (setq nvl (cdr nvl))
  69.       (if (not (vlax-curve-isclosed pl))
  70.         (setq nvl (cons a nvl))
  71.       )
  72.       (setq nvl (reverse nvl))
  73.       (vl-cmdf "_.3DPOLY")
  74.       (foreach v nvl
  75.         (vl-cmdf "_non" v)
  76.       )
  77.       (if (vlax-curve-isclosed pl)
  78.         (while (< 0 (getvar (quote cmdactive)))
  79.           (vl-cmdf "_C")
  80.         )
  81.         (while (< 0 (getvar (quote cmdactive)))
  82.           (vl-cmdf "")
  83.         )
  84.       )
  85.     )
  86.   )
  87.   (*error* nil)
  88. )
  89.  

Regards, M.R.
8
On both others and my BricsCAD installations v22 through v24, the status bar works intermittently but then becomes nonfunctional (or freezes). This occurs on less demanding design tasks containing only basic 2D elements with no external resource file references, of course, no 3D, point clouds, etc.

ISSUE
The coordinates display and buttons become unresponsive.

WORKAROUND
Only the workaround in the title, first minimizing and then maximizing the application window restores its functionality. We are on the Windows 11 OS.

QUESTIONS
1.) Has anyone experienced this issue?
2.) If so, how did you resolve it?

UPDATE
I updated the graphics driver. There was no change: the status bar issue remained.

See attached laptop specifications.

Thanks,

Clint
 
9
AutoLISP (Vanilla / Visual) / Re: Attribute Text Width
« Last post by MeasureUp on May 07, 2024, 11:17:55 PM »
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)
)
10
Thank you Joe!  Working parallel circuitry and your code works great for locating minimum margins between two polyline objects.  Appreciated!
Pages: [1] 2 3 ... 10