.NET

Reply
Contributor
f.roels
Posts: 12
Registered: ‎09-23-2011
Message 1 of 5 (260 Views)

stretch block dynamic grips

260 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
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 2 of 5 (247 Views)

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.

Distinguished Contributor
SRSDS
Posts: 243
Registered: ‎04-15-2011
Message 3 of 5 (236 Views)

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
f.roels
Posts: 12
Registered: ‎09-23-2011
Message 4 of 5 (213 Views)

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
f.roels
Posts: 12
Registered: ‎09-23-2011
Message 5 of 5 (211 Views)

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community