Jump to content

Recommended Posts

Posted

Anyone have any ideas what I am doing wrong with this code? I keep getting a error, "Invalid argument FilterType in Select" at this point in my code.

 
mySS.Select(AcSelect.acSelectionSetAll, , , GrpC, GrpV)
[html] 

I have a block in my drawing that I am trying to show. The block is called ASTAMP. It is in the drawing, and I am not sure what I am doing wrong to make this blow up.

 

 
Public Sub ShowBlock(ByVal ThisDrawing As AcadDocument)
    Dim mySS As AcadSelectionSet
    Dim GrpC(4) As Object
    Dim GrpV(4) As Object
    Dim myBlkRef As AcadBlockReference

    GrpC(0) = 0 : GrpV(0) = "INSERT"
    GrpC(1) = -4 : GrpV(1) = "<or"
    GrpC(2) = 2 : GrpV(2) = "ASTAMP"
    GrpC(3) = -4 : GrpV(3) = "or>"
    GrpC(4) = 67 : GrpV(4) = 1 'paperspace

    On Error Resume Next
    ThisDrawing.SelectionSets.Item("TempSSett").Delete()

    mySS = ThisDrawing.SelectionSets.Add("TempSSett")
    mySS.Select(AcSelect.acSelectionSetAll, , , GrpC, GrpV)

    For Each myBlkRef In mySS
         myBlkRef.Visible = True
         myBlkRef.Update()
    Next

    mySS.Delete()
End Sub 

Any ideas or leads would be greatly appreciated.

 

Rodney

Posted

That seemed to stop me from getting the error, so thanks for that, but any ideas why it doesn't find my block. The count always says 0. The name is spelled correctly in my code and in the drawing???

Posted
That seemed to stop me from getting the error, so thanks for that, but any ideas why it doesn't find my block. The count always says 0. The name is spelled correctly in my code and in the drawing???

 

What is the purpose of "" in your code, as you only list one DXF 2 parameter?

 

^^ I know what they do, I don't understand why their are included in your code.

 

Separately, is the block dynamic, by chance? ... Are the Name and EffectiveName Properties the same?

Posted

Separately, is the block dynamic, by chance? ... Are the Name and EffectiveName Properties the same?

 

I don't know what you mean by this?

 

The "OR" thing, you are probably right, I took them out. I did have more than one when I originally wrote this code in VBA.

Posted

Is your block dynamic?

 

I ask, because when a block is dynamic the DXF 2 (Name) value is sometimes required to be "`*U*" (aka Anonymous), and therefor no longer selectable by the name.

 

In LISP, we often use (2 . ",`*U*") in our selection set filter, because the dynamic block's DXF 2 value only changes onec the block's dynamic properties have changed.

 

To see what I mean about the block's properties, paste this at your command line, then type "DUMP" + hit Enter:

 

(defun c:DUMP  ( / eName)
 (vl-load-com)
 (if (setq eName (car (entsel "\nSelect object: ")))
   (progn
     (textpage)
     (vlax-dump-object (vlax-ename->vla-object eName) T))
   (prompt "\n** Nothing selected ** "))
 (princ))

 

... Select your block. What are the values of the properties listed above?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...