Recent Posts

Pages: 1 [2] 3 4 ... 10
11
hi
this this

Code: [Select]
 
 ;; HOSNEYALAA 23.10.2020 ;;

(vl-load-com)

(defun c:test (/ A11 A2 A3 ACDBBLOCKREFERENCE ATTDATA ATTRIBUTES^ ATTS LST PATTERN SS0)

 
 (if  (and
       (progn (initget 7)  (setq pattern(getint  "\nSpecify input NO : ")))
       (setq ss0 (ssget '((0 . "insert") (66 . 1))))
     )
  (progn
   
   
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss0)))
;;;      (setq ename (mapcar'vlax-ename->vla-object(vl-remove-if 'listp (mapcar 'cadr (ssnamex ss0))))
    (setq AcDbBlockReference (vlax-ename->vla-object ename))
;;;    (setq attributes^ (vlax-invoke AcDbBlockReference 'GetAttributes))
    (progn
           (setq atts (vlax-invoke AcDbBlockReference 'getattributes))
           (foreach att atts
             (cond
                   ((wcmatch (vla-get-tagstring att) "DIAMETRU")
                    (setq a2 (vla-get-textstring att))
                   )
                   ((wcmatch (vla-get-tagstring att) "Lungimea")
                    (setq a3 (vla-get-textstring att))
                   )
             )
                 
           )
           (setq attdata (cons (list (atof a2) (atof a3) AcDbBlockReference) attdata))
         )
     )
;;;(setq attdata nil)
    ; sorts on 1st two items

   ;;BIGAL
      (setq lst (vl-sort attdata
'(lambda (a b)
    (cond
      ((< (car a) (car b)))
      ((= (car a) (car b)) (< (cadr a) (cadr b)))
    )
  )
)
)

(setq  a  (car(car lst)) b (cadar lst))

   (foreach ename lst
;;;      (setq ename (cadr lst))
   
   
    (progn
           (setq atts (setq attributes^ (vlax-invoke (caddr ename) 'GetAttributes)))
     
           (foreach att atts
;;;      (setq att (car atts))
     
             ( if     (and (wcmatch (setq a11(vla-get-tagstring att)) "Pozitia") (equal a (setq ach  (car ename))) (equal b (setq bch  (cadr ename))))
     (progn
                             (vla-put-textstring att (RTOS pattern 2 0 ))
  (setq a ach
                                b bch
                                   )
        );;progn
       )

     ( if     (and (wcmatch (setq a11(vla-get-tagstring att)) "Pozitia")
   (or (/= a (setq ach  (car ename))) (/= b (setq bch  (cadr ename))))
   )
     (progn
                             (vla-put-textstring att (RTOS (setq pattern (+ 1 pattern)) 2 0 ))
(setq a ach
                                b bch
                                   )
        );;progn
       )

     

               
         );;;(foreach
     
     );;;; progn

     
  ) ;;;(foreach



      );;;; progn
 ); if

 (princ)
);















12
AutoLISP (Vanilla / Visual) / Re: Running External Programs
« Last post by cmwade77 on Today at 11:43:41 AM »
everyone says what I am doing is literally impossible

summary of my career right there, lol :-D

When it fully works, I will have an amazing way to make sheet indexes and keep them up to date, including revision numbers inside of blocks in a table.

That's pretty awesome. I'm honoured I could contribute a little here, a little there.
It will be once all is said and done, there are a lot of moving pieces and unfortunately, using the actual Revision Number field in the sheet set manager doesn't seem to work well, there is something funky with that field. I will keep at it, as eventually I want to use that, but in the meanwhile I have a work around.
13
You can check the contenttype property of the Multileader, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. (= acmtextcontent (vla-get-contenttype <mleader-object>))
14
I have a routine here that enables the background mask for both text and multileaders. However, multileaders do not always contain text, such as the case when a user block is used, in which case the background mask property does not apply. How can I handle this in the code below? I get an automation error with no description when I try to get the TextBackgroundMask property. And checking if it is available returns true so I cant filter out that object with this method either (vlax-property-available-p x "TextBackgroundFill" T).

When dumping a multileader with a block the TextBackgroundMask reads "Exception Occured". I have searched high and low and have not seen anything yet on how to handle this or how I can leverage my code to realize this object's property is not editable.

I tried to use a Vl-catch-all-apply before checking that property (when it fails and routine drops out). I must be using it wrong or its because it is inside of a lambda.
Full disclosure my Vlisp knowledge is limited.

Portion of code I am talking about is below. Full code is attached as file. Again the problem is with the multileader section only.
Thank you
Code: [Select]
(vl-load-com)
 
  (AT:Undo "V" "B")
  ;; background offset setting
  (setq #BackgroundOffset 1)
  (cond
    ;; select mtext and multileaders
    ((setq #SSList
            (AT:SS->List (ssget ":L" '((0 . "MTEXT,MULTILEADER"))) T)
     ) ;_ setq
     ;; something selected, time to process data
     (mapcar
       '(lambda (x)
          (cond
            ;; mtext
            ((eq (vla-get-ObjectName x) "AcDbMText")
             (if (eq (vla-get-backgroundfill x) :vlax-false)
               (progn
                 ;; set backgroundfill to true
                 (vla-put-backgroundfill x :vlax-true)
                 ;; convert object to ename and entmod offset
                 (setq #Ent (entget (vlax-vla-object->ename x)))
                 (entmod (subst (cons 45 #BackgroundOffset)
                                (assoc 45 #Ent)
                                #Ent
                         ) ;_ subst
                 ) ;_ entmod
               ) ;_ progn
               ;; set backgroundfill to false
               ;(vla-put-backgroundfill x :vlax-false)
             ) ;_ if
            )
            ;; multileader
            ((eq (vla-get-Objectname x) "AcDbMLeader")
(vlax-property-available-p x "TextBackgroundFill" T);can the property be modified?
(if (vl-catch-all-apply (eq (vla-get-TextBackgroundFill x) :vlax-false));tried to use error catching unsuccesfully here.
(progn              
;; set background fill to true
(vla-put-TextBackgroundFill x :vlax-true)
;; convert object to ename and entmod offset
(setq #Ent (entget (vlax-vla-object->ename x)))
(entmod (subst (cons 141 #BackgroundOffset)
(assoc 141 #Ent)
#Ent
) ;_ subst
) ;_ entmod
) ;_ progn
;----else----- ;; toggle, set backgroundfill to false
;(vla-put-TextBackgroundFill x :vlax-false)
) ;end of if
            );end of condition
          ) ;_ cond
        ) ;_ lambda
       #SSList
     ) ;_ mapcar
    )
  ) ;_ cond
 
  (AT:Undo "V" "E")
 
  (princ)



15
I mark how is the result after your lisp , and how it should be
16
What is the required result
After you work soring
If you explain with a picture or a drawing
Because I am not good at English
17
Hi HOSNEYALAA !!!
it's work but final result is not like in the example.
the duplicated position should  be deleted.
apreciate your work , can you finish it please ?

18
AutoLISP (Vanilla / Visual) / Re: Running External Programs
« Last post by MP on October 22, 2020, 11:01:56 PM »
everyone says what I am doing is literally impossible

summary of my career right there, lol :-D

When it fully works, I will have an amazing way to make sheet indexes and keep them up to date, including revision numbers inside of blocks in a table.

That's pretty awesome. I'm honoured I could contribute a little here, a little there.
19
AutoLISP (Vanilla / Visual) / Re: Running External Programs
« Last post by cmwade77 on October 22, 2020, 07:45:11 PM »
I am quite surprised at how well this is working

oh ye of little faith 🙃
Considering everywhere says what I am doing is literally impossible, I definitely will admit to having little faith on this one.

When it fully works, I will have an amazing way to make sheet indexes and keep them up to date, including revision numbers inside of blocks in a table.
20
AutoLISP (Vanilla / Visual) / Re: Running External Programs
« Last post by MP on October 22, 2020, 05:40:14 PM »
Thank you, that did the trick

you're most welcome 👍

I am quite surprised at how well this is working

oh ye of little faith 🙃
Pages: 1 [2] 3 4 ... 10