Author Topic: big text select problem  (Read 1409 times)

0 Members and 1 Guest are viewing this topic.

dussla

  • Bull Frog
  • Posts: 291
big text select problem
« on: September 20, 2020, 04:20:19 AM »
hi firends
sorry i have  a problem ~ :oops:
this is  big text  extract code
pls  can you open attached file
with code if i select  object ,   result  is "aaaa"
pls what problem ?



(defun c:tl ()

  (vl-load-com)

(setq square (car (entsel "\n select object :: ")))
  (setq obj (vlax-ename->vla-object square))
  (setq lst (cons obj lst))
     
        (setq pts (gc:MBoundingBox lst))
      
      (setq ss (ssget "w" (car pts) (cadr pts)  '((0 . "TEXT,MTEXT"))) )
       
(setq i 0 )
(repeat (sslength ss)
(setq en (ssname ss i)
text-list (append text-list (list en))
i (1+ i)))
(setq th-list nil)
(mapcar '(lambda (x) (setq th-list (append th-list (list (cdr (assoc 40 (entget x))))))) text-list)
(setq MaxText (nth (car (vl-sort-i th-list '>)) text-list))
(setq    tvaluse (cdr(assoc 1 (entget maxtext))))

)




(defun gc:MBoundingBox (ObjectList / CoordList)
  (foreach o ObjectList
    (vla-getBoundingBox o 'minPt 'maxPt)
    (setq CoordList (cons (vlax-safearray->list minPt)
                          (cons (vlax-safearray->list maxPt) CoordList)
                    )
    )
  )
  (list (apply 'mapcar (cons 'min CoordList))
        (apply 'mapcar (cons 'max CoordList))
  )
)
« Last Edit: September 20, 2020, 04:24:55 AM by dussla »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: big text select problem
« Reply #1 on: September 20, 2020, 05:00:28 AM »
You need to localize the variable in the c:tl function.
https://www.theswamp.org/index.php?topic=55680.0

dussla

  • Bull Frog
  • Posts: 291
Re: big text select problem
« Reply #2 on: September 20, 2020, 01:37:39 PM »
You need to localize the variable in the c:tl function.
https://www.theswamp.org/index.php?topic=55680.0

really thank you , thank you ~

dussla

  • Bull Frog
  • Posts: 291
Re: big text select problem
« Reply #3 on: September 20, 2020, 02:37:10 PM »
You need to localize the variable in the c:tl function.
https://www.theswamp.org/index.php?topic=55680.0
sorry    i made code some 
but still error
ps  : this code work process code
        pls understand me ~~


problem : 

1. slow
2. error: bad argument type: lselsetp nil ( if i select   many  boundray rectangle   )


pls can you modify  some  ~
that is my limit


modified code



 (defun   C:ask( / k objset obj oyr ss  i text-list th-list entall )
 (vl-load-com)
 (setvar "osmode" 33)

 
(setq k 0)

(setq objset (ssget (list '(0 . "*polyline") (cons 410 (getvar 'ctab)))))

   
    (repeat (sslength objset)
   
            (setq obj (ssname objset k)) 
   
   
   
                  
             (setq oyr (vlax-ename->vla-object obj))
            
             (setvar "osmode" 0)
            (vla-getboundingbox oyr 'minpt 'maxpt)
            (setq minpt (vlax-safearray->list minpt)
            maxpt (vlax-safearray->list maxpt)
            )
            
         
            (setq ss (ssget "_w" minpt maxpt (list (cons 0 "text"))))
            
            
            
                  
                     
         

               (setq i 0 )
               (repeat (sslength ss)
                  (setq en (ssname ss i)
                  text-list (append text-list (list en))
                  i (1+ i))
            
            )
            (setq th-list nil)
            (mapcar '(lambda (x) (setq th-list (append th-list (list (cdr (assoc 40 (entget x))))))) text-list)
         (setq MaxText (nth (car (vl-sort-i th-list '>)) text-list))
            (setq    pltn (cdr(assoc 1 (entget  MaxText))))
            
            
               
               
               
               
               (setq  allsee (ssget "_X" '((60 . 0)(0 . "~VIEWPORT"))))
               (setq  sd  (ssget  "x"  (list '(0 . "hatch") (cons 410 (getvar "ctab")))))
               (setq  tsd  (ssget  "x"  (list '(0 . "*TEXT") (cons 410 (getvar "ctab")))))
               
               
               (off sd)
               (off tsd)
               
               
            
               
               
               (setq entall (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
               (vlax-map-collection entall '(lambda(x) (vla-put-visible x -1)))
               
               
               
            
               (setq  sd  (ssget  "x"  (list '(0 . "hatch")   )))
               (seiso  allsee sd )
               
            
               
               
               
               (setq  sd  (ssget  "x"  (list '(0 . "*TEXT")   )))
               (seiso  allsee sd )
               
            
             
            
            
            
            
             (setq entall (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
              (vlax-map-collection entall '(lambda(x) (vla-put-visible x -1)))
               
               
(setq   k ( 1+ k )   )



 )
 
 )
 
 
 
 
 
 

(defun seiso (seAll seon /   idx) 
   

  (setq idx 0)
  (repeat (sslength seAll)
    (vlax-put-property (vlax-ename->vla-object (ssname seAll idx)) 'Visible :vlax-false)
    (setq idx (1+ idx))
    );end repeat

 
  (setq idx 0)
  (repeat (sslength seOn)
    (vlax-put-property (vlax-ename->vla-object (ssname seOn idx)) 'Visible :vlax-true)
    (setq idx (1+ idx))
    );end repeat

 
  )
 
 
(defun OFF(OL / OBJNUM SSOBJ OBJECT OBJLIST)
   (setq OBJNUM 0)
      (repeat (sslength OL)
            (setq SSOBJ (entget (ssname OL OBJNUM))
                 OBJNUM (+ OBJNUM 1)
                 OBJECT (append SSOBJ (list (cons 60 1)))
            )
         (if (= (cdr (assoc 0 SSOBJ)) "VIEWPORT")
            (princ "\nViewports cannot be turned off.")
         (entmod OBJECT)
         )
      )
)

 


roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: big text select problem
« Reply #4 on: September 21, 2020, 11:57:29 AM »
pls can you
I am sure it would be very convenient for you to have a person at the ready to check and improve your code whenever the need arises. But I am not that person.