Jump to content

Recommended Posts

Posted

I am not a programer but my boss wants me to do this so i am going to do my best to get it done. I need to create a userform that will allow for ten or so different selection rules for a drawing. These rules will turn layers in the drawing on and off depending on parameters in the selection rule. I have found a few things that I think might be helpful but I am unsure of how to change them or what I need to do to make them work for me. This is the code that I found for the layer selestion/fliltering.

 

Option Explicit

Public Function LayerSelection(strLayerName As String, strSSName) _
As AcadSelectionSet
Dim ssObjects As AcadSelectionSet
Dim intCode(0) As Integer
Dim varData(0) As Variant
Dim objCheck As AcadSelectionSet
'declare variables

intCode(0) = 8
'set variable for the dxf code for layer

varData(0) = strLayerName
'set variable for the layer name

Set ssObjects = ThisDrawing.SelectionSets.Add(strSSName)
'create a selection eset

ssObjects.Select acSelectionSetAll, , , intCode, varData
'select all entities on the specified layer

Set LayerSelection = ssObjects
'create a reference to the selection

End Function 

 

This is the code that I found for the user form.

 

Private Sub UserForm_Click()
   Me.Height = Int(Rnd * 500)
   Me.Width = Int(Rnd * 750)
   
End Sub

Private Sub UserForm_Initialize()
   Me.Caption = "Userform Events"
   Me.BackColor = RGB(10, 25, 100)
   
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
   msg = "Now Unloading " & Me.Caption
   MsgBox prompt:=msg, Title:="QueryClose Event"
   
End Sub

Private Sub UserForm_Resize()
   msg = "Width: " & Me.Width & Chr(10) & "Height : " & Me.Height
   MsgBox prompt:=msg, Title:="Resizing Event"
   
End Sub

Private Sub UserForm_Terminate()
   msg = "Now Unloading " & Me.Caption
   MsgBox prompt:=msg, Title:="Terminate Event"
   
End Sub

 

Like I said I have very little experience doing any programing so any help that I could get with this problem would be great.

Posted

This place will help you..http://www.cadtutor.net/forum/forumdisplay.php?f=21

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...