.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

stretch block dynamic grips

4 REPLIES 4
Reply
Message 1 of 5
f.roels
593 Views, 4 Replies

stretch block dynamic grips

Hi,

 

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?

 

thx

 

Filip

4 REPLIES 4
Message 2 of 5
DiningPhilosopher
in reply to: f.roels

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.

Message 3 of 5
SRSDS
in reply to: f.roels

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

 

Message 4 of 5
f.roels
in reply to: DiningPhilosopher

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.

 

thx

 

Filip

 

 

Message 5 of 5
f.roels
in reply to: SRSDS

Hi SRSDS

 

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.

 

best

 

Filip

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost