Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/02/2023 in all areas

  1. (mapcar '(lambda ( x ) (nth x lst)) (vl-sort-i lst '<))
    1 point
  2. Oh, just had a brain storm If I used entsel for the main polyline, could I then use something like (setq ent (entsel) ;select the main polyline (setq otblst (ssget "wp" ent) ;select all objects within the polyline
    1 point
  3. Using Vl-sort need to take into account type of items in list strings, real and integers, or combinations. So theVL-sort is slightly different. You can sort a list to multiple depths I have some code taht looks at up to the first 5 items in a list used with extract quantities. ;x only (setq lst (vl-sort lst '(lambda (x y) (< (car x)(car y))))) (vl-sort '(3 2 1 20 98.32 16 0 20 -2.345) '<) (-2.345 0 1 2 3 16 20 98.32) only 1 20 (setq test '(87 6.54 20 1 8.88 20)) ; contains two 20's (mapcar 'cdr (vl-sort (mapcar '(lambda (x) (cons 1 x)) test) '(lambda (y z) (< (cdr y) (cdr z))))) returns: (1 6.54 8.88 20 20 87); both 20's still there ; 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
  4. I'm pleased that you find this old application useful; though, you may find my more recently developed Batch Attribute Editor application a more powerful attribute editing utility, given that it offers the ability to edit attribute values across multiple blocks of varying block names. You may argue that the use of a Script file to perform the attribute modification across multiple drawings is inherently less powerful than the ObjectDBX interface leveraged by this older program, however, ObjectDBX has too many bugs where attribute modification is concerned and so I have since abandoned it's use for this purpose. Nevertheless, to allow the user to specify tags containing slashes (and other such characters), change the following lines: Line 1265 from: ( (or (not (snvalid str)) (vl-string-position 32 str)) To: ( (vl-string-position 32 str) Line 1457 from: ( (or (not (snvalid str)) (vl-string-position 32 str)) To: ( (vl-string-position 32 str) Line 1579 from: ( (or (not (snvalid new_tag)) (vl-string-position 32 new_tag)) To: ( (vl-string-position 32 new_tag) Line 2485 from: ( (or (not (snvalid tag_str)) (vl-string-position 32 tag_str)) To: ( (vl-string-position 32 tag_str)
    1 point
  5. Yes, that would work for objects residing in Modelspace. Though, as Stefan has noted above, be aware that the program will error with objects which do not meet the criteria for a region, so you may wish to include some error trapping to either prevent the user from selecting invalid objects, or a vl-catch-all-apply expression as used by Stefan to catch the error should an invalid object be selected. For objects residing in any space, consider the following method: (defun c:reg ( / doc ent obj ) (if (setq ent (car (entsel))) (progn (setq obj (vlax-ename->vla-object ent) doc (vla-get-activedocument (vlax-get-acad-object)) ) (vlax-invoke (if (vlax-method-applicable-p doc 'objectidtoobject32) (vla-objectidtoobject32 doc (vla-get-ownerid32 obj)) (vla-objectidtoobject doc (vla-get-ownerid obj)) ) 'addregion (list obj) ) ) ) (princ) ) (vl-load-com)
    1 point
×
×
  • Create New...