Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;-----------------------
  2. ;-------- INFO ---------
  3. ;-----------------------
  4.  
  5. ;wybrac blok i sprawdzic wartos atrybutu odmiana
  6. ;-selekcja trojkotna aby wybral wylacznie obietky z warstwy bloki, pozostawil w selekcji tylko z wlasciwym atrybutem, zmienil na niebieksi
  7. ;-selection crossing bo wiecej rzecz ywskoczy
  8.  
  9. ;1. wskazać blok, sprawdzić wartość atrybutu odmiana. poprzez entsel ;;;selection1
  10. ;2. selekcja trójkątna na warstwie bloki
  11. ;3. pozostawił w selekcji tylko z właściwym atrybutem
  12. ;4. zmienił kolor wybranych obiektów na niebieski.
  13.  
  14. ;-----------------------
  15. ;--------- INI ---------
  16. ;-----------------------
  17.  
  18. (vl-load-com)
  19. (setq aplikacja (vlax-get-acad-object))
  20. ;;;(vlax-dump-object aplikacja T)
  21. (setq sciezka (vlax-get-property aplikacja "path"))
  22. (setq sciezka (vla-get-path aplikacja))
  23. (setq aktywny (vla-get-activedocument aplikacja))
  24. (setq blocks (vla-get-blocks aktywny))
  25. (setq mspace (vla-get-modelspace aktywny))
  26.  
  27. (setq blocksL nil mspaceL nil )
  28.  
  29. (vlax-for iblock blocks
  30.     (if (= (vla-get-islayout iblock) :vlax-false)
  31.         (setq blocksL (append blocksL (list iblock)))
  32.         )
  33. )
  34.  
  35. (vlax-for item mspace
  36.     (if (= (vla-get-objectname item) "AcDbBlockReference")
  37.         (setq blocksrefL (append blocksrefL (list item)))
  38.     )
  39. )
  40.  
  41. ;-----------------------
  42. ;------ FUNCTIONS ------
  43. ;-----------------------
  44.  
  45.  
  46.  
  47. ;-----------------------
  48. ;------- PROGRAM -------
  49. ;-----------------------
  50.  
  51. (setq selection1 nil)
  52. ;(setq selection1 (entsel "Please choose an object: "))
  53. (setq selection1 (ssget))
  54.  
  55. ;-------------------------------------------------------
  56.  
  57. (setq blockref1 nil)
  58. (setq blockref1 (vlax-ename->vla-object (ssname selection1 0)))
  59.  
  60. (setq atributes nil)
  61. (setq atributesSA nil)
  62. (setq atributesL nil)
  63.  
  64. (setq atributes (vla-GetAttributes blockref1))
  65. (setq atributesSA (variant-value atributes))
  66. (setq atributesL (safearray-value atributesSA))
  67.  
  68. (foreach iattribute atributesL
  69.     (setq tagtextstringL (append tagtextstringL
  70.     (list (list (vla-get-tagstring iattribute)
  71.         (vla-get-textstring iattribute))))
  72.     )
  73. )
  74. (print tagtextstringL)
  75.  
  76. ;------------------------------------------------------- triangle sel
  77. (setq pt1 nil)
  78. (setq pt2 nil)
  79. (setq pt3 nil)
  80. (setq triangleSelection nil)
  81. (setq pt1 (getpoint "p1:") )
  82. (setq pt2 (getpoint "p2:") )
  83. (setq pt3 (getpoint "p3:") )
  84. (setq triangleSelection (ssget "WP" (list pt1 pt2 pt3)'((8 . "bloki"))))
  85.  
  86. ;------------------------------------------------------- change color
  87.  
  88. (setq i 0)
  89. (while (< i (sslength triangleSelection))
  90.     (setq tmpEnt (ssname triangleSelection i))
  91.     (setq tmpObj (vlax-ename->vla-object tmpEnt))
  92.  
  93.     (setq oColor (vlax-get-property tmpObj 'TrueColor))
  94.     (vlax-invoke-method oColor 'SetRGB 0 0 255)
  95.     (vlax-put-property tmpObj 'TrueColor oColor)
  96.     (vla-update tmpObj)
  97.  
  98.     (setq i (+ i 1))
  99. )
  100.  
  101.  
  102.  
  103.  
  104. ;-----------------------
  105. ;--------- EOF ---------
  106. ;-----------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement