I have a problem with dynamic blocks.
I have inserted a dynamic block (with .NET) and changed the value of a dynamic parameter (Linear). The block is stretched as it should be. (no problems here).
After a fiew other routines, I select the block again (by using its objectID) and a want to get the coördinates of the grip of the linear dynamic paramter. Is there a way to get the coördinates based on the linear dynamic parameter and its grip points? Can someone help me wit a pease of code in vb.Net?
You can use a point parameter with a stretch action, and if you need the dimension you can use two stretch actions, one with a point parameter and the other with a linear parameter. Using a stretch action with a point parameter makes the point a property of the dynamic block reference.
Try this. sPropertyName is the name of the dimension or any other dynamic property of your block.
Public Function GetDybpropValue(ByVal BlockID As ObjectId, ByVal sPropertyName As String, ByRef trans As Transaction) Try Dim br As BlockReference = DirectCast(trans.GetObject(BlockID, OpenMode.ForRead), BlockReference) Dim pc As DynamicBlockReferencePropertyCollection = br.DynamicBlockReferencePropertyCollection ' Loop through, getting the info for each property For Each prop As DynamicBlockReferenceProperty In pc If prop.PropertyName = sPropertyName Then Return prop.Value Exit For End If Next br.Dispose() pc.Dispose() Catch ex As Autodesk.AutoCAD.Runtime.Exception MsgBox("Exception:" + ex.Message) End Try GetDybpropValue = 0 End Function
Hi Dining Philosopher,
working with a additional point parameter seems a good "workaround" I'm going to try this.
However It would by cleaner if it is possible to ask the coördinates directly of the grippoint of the linear parameter. I don't know. But for the time being I'm going to try your sollution.
I know how to ask the value of a dynamic linear propert, but thanks for your input.
However this isn't giving the coördinates of the grip point. With all the different angles (it is a block placed in 3D) you can calculate the position. But I'm trying to keep the code as quickly as possible. I have to work on to many blocks on each routine.
Access a broad range of knowledge to help get the most out of your products and services.