Results 1 to 6 of 6

Thread: Sub entity slection within a selection set?

  1. #1
    Member
    Join Date
    2002-11
    Posts
    42
    Login to Give a bone
    0

    Default Sub entity slection within a selection set?

    I have a lsip I have been working with off and on for awile. I have the main selection set working and can manipulate those blocks (I have commented the manipulation portion out, I used it for testing) I have placed some basic code below the main to do some testing also. this works by picking the nested entities. What I would like to do is select the arcs and splines within the selection set of blocks and change the lintype of the entities. I hope this is clear enough.
    Code:
    (defun c:fH (/ ssets acadDocument newsset ctr item)
      (vl-load-com)				; load the visual lisp extensions
      
      (setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
    					;retrieve a reference to the documents object
      (setq ssets (vla-get-selectionsets acadDocument))
    
    					;retrieve a reference to the selection sets object
      (setq newsset (vla-add ssets "SS1"))	;add a new selection set
      (setq filter_code (vlax-make-safearray vlax-vbinteger '(0 . 4)))
    					;create a 5 element array for the DXF Code
      (setq filter_value (vlax-make-safearray vlax-vbvariant '(0 . 4)))
    ;;;;create a 5 element array for the values
      (vlax-safearray-fill filter_code '(0 -4 8 8 -4))
    ;;;;DXF Code for Objects and Layer
      (vlax-safearray-fill
        filter_value
        '("insert" "<OR" "A-Hist" "A-HIST-2000" "OR>")
      )
    ;;;;the filter values
      (vla-select
        newsset acSelectionSetAll nil nil filter_code filter_value)
    
      
    ;;;;;;;select ALL Blocks on Layers A-hist or a-hist-2000
    ;;;  (setq ctr 0)				;set the counter to zero
    ;;;  (repeat (vla-get-count newsset)	;count the number of objects and loop
    ;;;    (setq item (vla-item newsset ctr))	;retrieve each object
    ;;;    (setq check (vlax-property-available-p item "LAYER" T))
    ;;;					;check if the entity has a layer property and can it be updated 
    ;;;    (if	check				;if it can
    ;;;      (vlax-put-property item 'LAYER "A-WALL-SLAB") ;change it's layer
    ;;;    )					; end if
    ;;;    (setq ctr (1+ ctr))			;increment the counter
    ;;;  )					;repeat
    ;;;  (vla-delete (vla-item ssets "SS1"))	;delete the selection set
    ;;;  (princ)
    ;;;)					;defun
    ;;;(princ)
    ;;;					;if
    
    
    
    
    (setq old_arc (entget (car (nentsel))));select nested arcs
          (setq new_arc (subst (cons 6 "Phantom") (assoc 6 old_arc) old_arc));substitute new linetype to arc
           (entmod new_arc);force new linetype on arc
          (command "regenall");regenerate drawing to see results
    
    
    
    (setq old_spline (entget (car (nentsel))))
          (setq new_spline (subst (cons 6 "Phantom") (assoc 6 old_spline) old_spline))
           (entmod new_spline)
         (command "regenall")

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Sub entity slection within a selection set?

    Do you want to change all arcs and splines for the selected block references? Or are you trying to have the user pick the arc or spline to change?

    P.S. Using ActiveX selection sets in Visual LISP is like trying to make mashed potatoes with a sledge hammer. Sure it works, but using a potato masher is far easier. In other words, use the LISP (ssget) function.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  3. #3
    Member
    Join Date
    2002-11
    Posts
    42
    Login to Give a bone
    0

    Default Re: Sub entity slection within a selection set?

    Yes I am trying to change all of of the arcs and splines without selecting them. I used the VLISP selection set mainly just for tutorial purposes. SSGET is way easier and cleaner too. This was all started by 2010 not including VBA. I know it is available but trying to get away from it. I dont really want to learn VB.Net at the moment.

  4. #4
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Sub entity slection within a selection set?

    Quote Originally Posted by voigtmark View Post
    Yes I am trying to change all of of the arcs and splines without selecting them. I used the VLISP selection set mainly just for tutorial purposes. SSGET is way easier and cleaner too. This was all started by 2010 not including VBA. I know it is available but trying to get away from it. I dont really want to learn VB.Net at the moment.
    After you have the selection set of block references, you need to determine the blocks that you need to modify (after all, multiple block references may refer to the same block object). Once you have a list of blocks to edit, get each block's object and iterate thru their objects. When you find an arc or spline, change its properties.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  5. #5
    Member
    Join Date
    2002-11
    Posts
    42
    Login to Give a bone
    0

    Default Re: Sub entity slection within a selection set?

    I apologize, but I am a bit lost. Just a prod in the right direction would help. I have a VBA code that works but I am having trouble converting. If I post the VBA code would that help? I just want to learn. I dont expect someone to do it for me.

  6. #6
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Sub entity slection within a selection set?

    Iterate thru your selection set using ssname. If the block name of the current block reference is not in a list of fixed blocks, get the block object, fix the block, and then add that block name to the list of fixed blocks.

    Untested:
    Code:
    (vl-load-com)
    (setq fixedBlocks '())
    (setq allBocks (vla-Get-Blocks (vla-Get-ActiveDocument (vlax-Get-Acad-Object))))
    (repeat (setq i (sslength ss))
     (setq i (1- i))
     (setq blockRef (vlax-ename->vla-object (ssname ss i)))
     (cond ((not (member (setq blockName (vla-Get-Name blockRef)) fixedBlocks))
      (setq fixBlock (vla-Item allBlocks blockName))
      (vlax-For aObject fixBlock
       (cond ((wcmatch (vla-Get-ObjectName aObject) "AcDbArc,AcDbSpline")
        (vla-Put-Linetype aObject "Phantom"))))
      (setq fixedBlocks (cons blockName fixedBlocks)))))
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

Similar Threads

  1. Replies: 6
    Last Post: 2012-05-01, 07:40 PM
  2. entity selection
    By mdsalman2003 in forum AutoLISP
    Replies: 1
    Last Post: 2010-06-30, 08:52 PM
  3. Layers are changing in the Slection Tree
    By anthony.foster-davis in forum NavisWorks - General
    Replies: 0
    Last Post: 2009-06-15, 10:13 PM
  4. Getting "Invalid Entity Name" for Selection Set
    By mgore in forum VBA/COM Interop
    Replies: 1
    Last Post: 2008-10-30, 09:10 PM
  5. Add last entity created to selection set
    By cgerhardt in forum VBA/COM Interop
    Replies: 2
    Last Post: 2006-11-16, 08:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •