Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;1. dokonać selekcji poligonalnej, obiekty muszą się w całości mieścić w oknie
- ;2. pozostawić tylko te, których sumaryczne pole >460
- ;3. dodać warstwę "wynik" i przenieść na nią selekcję
- ;4. wyłączyć pozostałe warstwy
- ;1. Create a polygonal selection. The selected objects have to be completly inside the selection
- ;2. Leave only those, whose total area is > 460
- ;3. Add a layer "result" and move the selection to it
- ;4. Disable/hide the other layers
- (defun ConvList_to_VariantArray (InList SAType / LengthList iCount iList)
- (setq LengthList (length InList))
- (setq OutSaveArray (vlax-make-safearray SAType (cons 0 (1- LengthList) ))) ;;; '(l-bound . u-bound)
- (setq iCount 0)
- (repeat LengthList
- (setq iList (nth iCount InList))
- (vlax-safearray-put-element OutSaveArray iCount iList)
- (setq iCount (1+ iCount))
- ); end repeat
- (vlax-make-variant OutSaveArray ) ; return this value.
- )
- ;; zad1
- (setq application (vlax-get-acad-object))
- (setq *ActiveDocument* (vla-get-activedocument application))
- (setq *SelectionSets* (vla-get-SelectionSets *ActiveDocument*)); - get the selectionset / pobranie kolekcji selectionsets
- (vla-Add *SelectionSets* "SelAll");
- (setq SelAll (vla-item *SelectionSets* "SelAll" ))
- (repeat 5
- (setq points_list (append points_list (getpoint)))
- )
- ;(43 3244 543 645 577 876)
- (setq FilterType nil FilterData nil)
- (setq FilterType (ConvList_to_VariantArray (list 8) vlax-vbInteger))
- (setq FilterData (ConvList_to_VariantArray (list (vlax-make-variant "0")) vlax-vbVariant))
- (vla-clear SelAll)
- (vla-SelectByPolygon SelAll acSelectionSetWindowPolygon (ConvList_to_VariantArray points_list vlax-vbDouble) FilterType FilterData)
- ;;zad2
- (setq todelete nil)
- (setq mspace (vla-get-modelspace *ActiveDocument*))
- (setq blocksL nil)
- (vlax-for item mspace
- (if (= (vla-get-objectname item) "AcDbBlockReference")
- (setq blocksrefL (append blocksrefL (list item)))
- )
- )
- (setq blockarea nil)
- (setq area 0)
- (foreach oneblok blocksrefL
- (vlax-for item oneblok
- (if (= (vlax-property-available-p item 'Area) T)
- (progn
- (setq area_of_element (vla-get-area item))
- (setq area (+ area area_of_element ))
- )
- )
- )
- (setq area 0 )
- (setq blockarea (append blockarea (list (list oneblok area))))
- )
- (vlax-for item Selall
- (foreach itemsres blockarea
- (if (= (vla-get-objectID item) (vla-get-objectID (nth 0 itemsres)))
- (progn
- (if (> (nth 1 itemsres) 460 )
- (setq todelete (append todelete item))
- )
- )
- )
- )
- )
- ;;;(setq todelete nil)
- ;;;(vlax-dump-object SelAll t )
- ;;;(vlax-for itemall SelAll
- ;;; (setq atributes (vla-GetAttributes itemall))
- ;;; (setq atributesSA (variant-value atributes))
- ;;; (setq atributesL (safearray-value atributesSA))
- ;;; (if (/= (vla-get-textstring (nth 0 atributesL)) nazwa_jabka)
- ;;; (setq todelete (append todelete (list itemall)))
- ;;;
- ;;; )
- ;;;
- ;;; )
- ;;;; do suswanie elementów z slekcji
- ;;;(setq NObj (length todelete))
- ;;;(setq SelObjArray (vlax-make-safearray vlax-vbObject (cons 0 (1- NObj) )));zmiana listy na variant typu SafeArray:
- ;;;(setq iCount 0)
- ;;; (repeat NObj
- ;;; (setq iList (nth iCount todelete))
- ;;; (vlax-safearray-put-element SelObjArray iCount iList)
- ;;; (setq SelObjArrayVar (vlax-make-variant SelObjArray))
- ;;; (setq iCount (1+ iCount))
- ;;; )
- ;;;
- ;;;
- ;;;(vla-RemoveItems SelAll SelObjArrayVar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement