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

Reading All Parametirc Dimension Constraint Information.

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

Reading All Parametirc Dimension Constraint Information.

I recently wrote a small tidbit to export all parametric userparameters in a document.

 

What I need to do is modify it to include Dimensional Contraint information as well.

Any help?

 

--- My code to export userparameters follows ---

 

 

PublicSharedSub CopyParameters()

   

  Dim varId AsObjectId = ObjectId.Null   

  Dim doc AsDocument = Application.DocumentManager.MdiActiveDocument   

  Dim db AsDatabase = doc.Database   

  Dim sClip AsString = ""

   

  Using myT AsTransaction = db.TransactionManager.StartTransaction()     

' Open the AssocNetwork

     

  Dim networkId AsObjectId = AssocNetwork.GetInstanceFromObject  (SymbolUtilityServices.GetBlockModelSpaceId(db), True, True, "")     

  Dim network AsAssocNetwork = DirectCast(myT.GetObject(networkId, OpenMode.ForWrite), AssocNetwork)

     

  ' Iterate through all actions in the network     

  Dim actionIds AsObjectIdCollection = network.GetActions

     

  ForEach actionId AsObjectIdIn network.GetActions

       

    If actionId.ObjectClass.IsDerivedFrom(RXObject.GetClass(GetType(Autodesk.AutoCAD.DatabaseServices.AssocVariable))) Then

         

      ' Is this action an AssocVariable?         

      Dim var AsAssocVariable = DirectCast(myT.GetObject(actionId, OpenMode.ForRead), AssocVariable)

         

        If var IsNotNothingThen

              sClip = var.Name & ControlChars.Tab & var.Expression.ToString & ControlChars.Tab & var.Value.ToString & ControlChars.NewLine         

        EndIf       

      EndIf     

    Next   

  EndUsing

   

  If sClip <> ""Then     

    Clipboard.SetText(sClip)     

    MessageBox.Show("All FX UserParameters are now on the Windows Clipboard")

  Else

       MessageBox.Show("No FX UserParameters Found")

  EndIf 

EndSub

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Can't believe I missed my error. 

 

sClip = Var.Name & ControlChars.Tab ...

Should have been

sClip &= Var.Name & ControlChars.Tab ...

 

As I was not concantinating on each loop only the last entry was saved.

 

Got a another couple of related questions thougjh.

 

1) What is the method to retreive parameters by group.

2) The value property does not return what I expected.

 

Message 3 of 3
Anonymous
in reply to: Anonymous

Looks like #2 boils down to converting the Value property from a resultbuffer into a typedvalue array.  then getting the value property of the typedvalue.

 

PrivateSharedFunction ResultBufferToText(ByVal rb AsResultBuffer) AsString   

  Dim tv() AsTypedValue = rb.AsArray   

  Return tv(0).Value.ToString() 

EndFunction

 

Strange that the documentation does not go into detail about:

Autodesk.AutoCAD.DatabaseServices.TypedValue()

and how to retreive data from them.

 

It appears that running the objectArx help didn't install help into VB.NET that I can see.

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