.NET

Reply
Contributor
12 Posts
0 Kudos
Registered: ‎09-23-2011
Post 1 of 5

stretch block dynamic grips

274 Views, 4 Replies
05-24-2013 08:10 AM

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

Valued Mentor
370 Posts
175 Kudos
Registered: ‎05-06-2012
Post 2 of 5

Re: stretch block dynamic grips

05-24-2013 05:57 PM 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.

Mentor
256 Posts
4 Kudos
Registered: ‎04-15-2011
Post 3 of 5

Re: stretch block dynamic grips

05-24-2013 09:25 PM 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

 

Contributor
12 Posts
0 Kudos
Registered: ‎09-23-2011
Post 4 of 5

Re: stretch block dynamic grips

05-26-2013 03:42 AM 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

 

 

Contributor
12 Posts
0 Kudos
Registered: ‎09-23-2011
Post 5 of 5

Re: stretch block dynamic grips

05-26-2013 03:50 AM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!