Jump to content

Recommended Posts

Posted

hello everyone,

 

i have in a dynamic block 2 parameters one for a distance et the second is a visibility. i want to do for each distance it make visibility defined.

 

for exemple distance = 10 then visibility = type 1

                       distance = 20 then visibility = type 2

                      distance = 30 then visibility = type 3

 

i succeeded to do in vba because i more confortable. does anyone knows can translate in lisp ?

 

 

 

 

Sub ChangeAttr_PP()

Dim objEnt As AcadEntity
Dim objBlock As AcadBlockReference
Dim objAttrib As AcadAttribute
Dim objAttribs As Collection
Dim dynBlkProp As Variant
Dim iCount As Integer
Dim pic(2) As Double

iCount = 0

'Debug.Print acadDoc.FullName
 ThisDrawing.Utility.GetEntity objBlock, pic

If objBlock.IsDynamicBlock Then

'get properties from dynamic BlockObj
Dim dybprop As Variant, I As Integer
Dim bobj As AcadEntity
Dim A As String

    For Each bobj In ThisDrawing.ModelSpace 'Get AutoCAD Entity's
        Debug.Print bobj.ObjectName
        If bobj.ObjectName = "AcDbBlockReference" Then 'Check if BlockRef
            If bobj.IsDynamicBlock Then 'Check to see if it is a Dynamic Block
            parameters = bobj.GetDynamicBlockProperties
            
                If bobj.EffectiveName = "3D multi - Rigid portal" Then 'Finds Dynamic Block NAME
                For I = LBound(parameters) To UBound(parameters) 'Goes through Results
                   If parameters(I).PropertyName = "d2" Then
                     If parameters(I).Value >= 10 Then A = "Type 1"
                     If parameters(I).Value >= 20 Then A = "Type 2"
                     If parameters(I).Value >= 30 Then A = "Type 3"
                   End If
               
                Next I
                
                  For I = LBound(parameters) To UBound(parameters) 'Goes through Results
                
                     If parameters(I).PropertyName = "Type" Then parameters(I).Value = A
                Next I
                
                
                End If
            End If
        End If
    Next

Else

End If

End Sub

 

 

 

 

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