Jump to content
frenkas

Dynamic Properties in Block - not Block refference

Recommended Posts

frenkas

Hello,

 

Simple question. Is it possible to get dynamic properties from AcadBlock not AcadBlockRefference?

 

As I didn't find any solution, I implemented this function:

Private Function ExistsDynPr(bb As AcadBlock, PropName As String) As Boolean
   Dim oProps As Variant
   Dim oDblkProp As AcadDynamicBlockReferenceProperty ', ap As AcadDynamicBlockReferenceProperty
   Dim I As Integer, pp(0 To 2) As Double, abr As AcadBlockReference
   Set abr = ThisDrawing.ModelSpace.InsertBlock(pp, bb.Name, 1, 1, 1, 0) 'bandom iterpti [laikinai]
   ExistsDynPr = False
   If abr.IsDynamicBlock Then
       oProps = abr.GetDynamicBlockProperties
       For I = 0 To UBound(oProps)
           Set oDblkProp = oProps(I)
           If oDblkProp.PropertyName = PropName Then
               ExistsDynPr = True
               abr.Delete
               Exit Function
           End If
       Next
   End If
   abr.Delete
End Function

Is there any side effects or risks of inserting block? If no I'll stick to this function, though I think it's not very nice solution.

Share this post


Link to post
Share on other sites
meyerforhire

Could you do something like:

 

Dim objEnt as AcadEntity

For Each objEnt in AcadBlock

If TypeOf objEnt is AcadDynamicBlockReferenceProperty Then ExistsDynPr = true

Next

 

I think that should work without having to insert.

Share this post


Link to post
Share on other sites
meyerforhire

I think I steered you wrong. I attempted to cycle through the dyn props of an AcadBlock and couldn't get an acknowledgement that any AcadDynamicBlockReferenceProperties were included in the AcadEntityObject inside the AcadBlock.

 

I tried to cycle through a bunch of blocks and delete all of the dynamic properties--I'm fed up with em'. Users love them, but there really hard to keep track of using vba. Check out the post I made a week or so ago titled "Dynamic Block Properties Quandry." It doesn't look like ACAD can keep track of the cohesive in a manner either--at least that I've found. No one has answered me back on that question I posted.

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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