+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2005
    Location
    Newcastle Upon Tyne
    Posts
    312

    Default macro to change the visibility of a particular dynamic block

    Registered forum members do not see this ad.

    i want to creat a macro that changes the visible status of a dynamic block. the idea being that when i run the macro it changes the visibilty to any 1 of 4 choices.

    i could go a bit fancier & get a form to load & query which choice but i'm think something a lot more simple. could start of with a different macro fo reach one. could anyone help me kick start the code?

    cheers!

    col

  2. #2
    Senior Member borgunit's Avatar
    Using
    Mechanical 2006
    Join Date
    May 2007
    Location
    Ohio USA
    Posts
    287

    Default

    This is part of a toolbox I found...

    Public Sub MakeObjSsInvisible(ByRef acSS As AcadSelectionSet)
    '------------------------------------------------------------------------------
    '
    '
    '------------------------------------------------------------------------------
    Dim sCurrLyr As String
    Dim objLayer As Object ' AcadLayers
    Dim objLayers As Object 'AcadLayers
    Dim acEnt As AcadObject
    '''''''''''''''''''''''''''''''''''''''
    For Each acEnt In acSS
    sCurrLyr = acEnt.layer
    Set objLayer = objLayers.Item(sCurrLyr)
    If objLayer.Lock Then
    objLayer.Lock = False
    acEnt.Visible = False
    objLayer.Lock = True
    Else
    acEnt.Visible = False
    End If
    acEnt.Update
    Next

    If Not acSS Is Nothing Then
    acSS.Delete
    End If

    End Sub
    AutoCAD Mechanical 2006
    XP PRO SP3
    http://mechcad-insider.blogspot.com/

  3. #3
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Visibility sets into dynamic block are not accessible via VBA...

  4. #4
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2005
    Location
    Newcastle Upon Tyne
    Posts
    312

    Default

    Really.... I thought everything was accessible!!? aw well thats that then!

    Thats a real shame as I had quite a few ideas for that type of function/ routine(not sure what the proper terminology is!).

    For this particular one it was going to be for my stamp eg draft, approval, construction or as built. Just thinking a simpler way would be to have a block called ‘stamp’ for example, in my dwg template. I could then have 3 block called the same name in separate files, each ones text value would be one of the types of issue eg draft, approval etc. I could then insert the relevant one into my current dwg, redefine the block when I insert it. This would then update the block ‘stamp’ contained within many layouts. I will try it tomorrow, can’t see any reason why it wouldn’t work(?) & it beats going thru each layout to update each text value manually!

    Am I over complicating things, is their a simpler way of doing it than that? Any suggestions would be appreciated?

    Cheers,

    col

  5. #5
    Senior Member borgunit's Avatar
    Using
    Mechanical 2006
    Join Date
    May 2007
    Location
    Ohio USA
    Posts
    287

    Default

    Registered forum members do not see this ad.

    See if this helps. Other than the clearing of the selection set, see if it will "grab" those entities.

    Private Sub GetInvisibleObjSs(ByRef acSs1 As AcadSelectionSet)
    '------------------------------------------------------------------------------
    'GetInvisibleObjSs: Makes all objects in an AutoCAD drawing visible.
    '
    '------------------------------------------------------------------------------
    Dim acSS As AcadSelectionSet
    Dim dPt1(0 To 2) As Double
    Dim dPt2(0 To 2) As Double
    Dim iCode(0) As Integer
    Dim vVal(0) As Variant
    '''''''''''''''''''''''''''''''''''''''
    iCode(0) = 60 'visibilty pair
    vVal(0) = 1 '1=invisible, 0=visible
    Set acSS = ClearSS("INVIS")

    acSS.Select acSelectionSetAll, dPt1, dPt2, iCode, vVal 'ALL OBJECTS
    Set acSs1 = acSS

    End Sub
    AutoCAD Mechanical 2006
    XP PRO SP3
    http://mechcad-insider.blogspot.com/

Similar Threads

  1. Dynamic block with dynamic attributes
    By Helenka in forum AutoCAD Drawing Management & Output
    Replies: 14
    Last Post: 28th Jul 2012, 09:56 am
  2. Dynamic block help...
    By James in forum AutoCAD General
    Replies: 4
    Last Post: 26th Aug 2009, 04:12 pm
  3. Macro for inserting a block
    By cisrael in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 17th May 2007, 06:09 pm
  4. Dynamic block?
    By alijahed in forum AutoCAD General
    Replies: 4
    Last Post: 8th May 2007, 12:01 am
  5. dynamic block attributes?
    By maxholer in forum AutoCAD General
    Replies: 6
    Last Post: 25th May 2005, 12:59 pm

Bookmarks

Posting Permissions

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