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

Dynamic Block and 2010th block Tables

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
458 Views, 2 Replies

Dynamic Block and 2010th block Tables

Hello, I'm on my first steps into .NET and I'm desperatly trying to "play" with dynamic blocks thrue my own library manager.
So, I actually sucessfully insert my blocks and manipulate the standard dynamic parametters such as visibility, dimensions, angles ...
I've got new 2010th blocks based on tables of parameters.
If I change the value of the parameter that is supposed to update the whole block, the only updated thing is the highlighted value of the drop down list of the bloc. Other values are not updated.

Here is a sample of my code ...
...
SetCustomProp(myBlk, PropName1, PropValue1)
....
Public Sub SetCustomProp(ByVal BlockID As DatabaseServices.ObjectId, _
ByVal PropName As String, ByVal PropValue As Short)

Dim myTransMan As DatabaseServices.TransactionManager
Dim myTrans As DatabaseServices.Transaction
Dim myDwg As Document

myDwg = Application.DocumentManager.MdiActiveDocument
myTransMan = myDwg.TransactionManager
myTrans = myTransMan.StartTransaction

Dim myBlockRef As DatabaseServices.BlockReference
myBlockRef = BlockID.GetObject(OpenMode.ForWrite)

Dim myDynamicPropsCollection As _
DatabaseServices.DynamicBlockReferencePropertyCollection
Dim myDynamicProp As _
DatabaseServices.DynamicBlockReferenceProperty
If myBlockRef.IsDynamicBlock Then
myDynamicPropsCollection = myBlockRef.DynamicBlockReferencePropertyCollection
For Each myDynamicProp In myDynamicPropsCollection
Select Case myDynamicProp.PropertyName.ToUpper
Case PropName.ToUpper
If myDynamicProp.UnitsType = DynamicBlockReferencePropertyUnitsType.Angular Then
myDynamicProp.Value = CDbl(PropValue) * Math.PI / 180
Else
myDynamicProp.Value = PropValue
End If
End Select
Next
End If

'Commit the Transaction
myTrans.Commit()

'Dispose of the Transaction Objects
myTrans.Dispose()
myTransMan.Dispose()
End Sub
...
I can see the table parameter during the loop into the collection, but no way to access its content or change any value ?

Any help will be welcome !
Thanks
Eric
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Can you post a sample drawing?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message
news:6270582@discussion.autodesk.com...
Hello, I'm on my first steps into .NET and I'm desperatly trying to "play"
with dynamic blocks thrue my own library manager.
So, I actually sucessfully insert my blocks and manipulate the standard
dynamic parametters such as visibility, dimensions, angles ...
I've got new 2010th blocks based on tables of parameters.
If I change the value of the parameter that is supposed to update the whole
block, the only updated thing is the highlighted value of the drop down list
of the bloc. Other values are not updated.

Here is a sample of my code ...
...
SetCustomProp(myBlk, PropName1, PropValue1)
....
Public Sub SetCustomProp(ByVal BlockID As DatabaseServices.ObjectId, _
ByVal PropName As String, ByVal PropValue As Short)

Dim myTransMan As DatabaseServices.TransactionManager
Dim myTrans As DatabaseServices.Transaction
Dim myDwg As Document

myDwg = Application.DocumentManager.MdiActiveDocument
myTransMan = myDwg.TransactionManager
myTrans = myTransMan.StartTransaction

Dim myBlockRef As DatabaseServices.BlockReference
myBlockRef = BlockID.GetObject(OpenMode.ForWrite)

Dim myDynamicPropsCollection As _
DatabaseServices.DynamicBlockReferencePropertyCollection
Dim myDynamicProp As _
DatabaseServices.DynamicBlockReferenceProperty
If myBlockRef.IsDynamicBlock Then
myDynamicPropsCollection =
myBlockRef.DynamicBlockReferencePropertyCollection
For Each myDynamicProp In myDynamicPropsCollection
Select Case myDynamicProp.PropertyName.ToUpper
Case PropName.ToUpper
If myDynamicProp.UnitsType =
DynamicBlockReferencePropertyUnitsType.Angular Then
myDynamicProp.Value = CDbl(PropValue) * Math.PI
/ 180
Else
myDynamicProp.Value = PropValue
End If
End Select
Next
End If

'Commit the Transaction
myTrans.Commit()

'Dispose of the Transaction Objects
myTrans.Dispose()
myTransMan.Dispose()
End Sub
...
I can see the table parameter during the loop into the collection, but no
way to access its content or change any value ?

Any help will be welcome !
Thanks
Eric
Message 3 of 3
Anonymous
in reply to: Anonymous

Hi ! Here is a block that might better help to understand !

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