dr.hybride Posted May 21, 2021 Posted May 21, 2021 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 Quote
BIGAL Posted May 21, 2021 Posted May 21, 2021 Have a look at Lee-mac.com for info about set visibility its in VL so close to VBA syntax. http://www.lee-mac.com/dynamicblockfunctions.html Quote
Recommended Posts
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.