How to get/set user parameters in AutoCAD 2015 using external vb.net

How to get/set user parameters in AutoCAD 2015 using external vb.net

Anonymous
Not applicable
842 Views
2 Replies
Message 1 of 3

How to get/set user parameters in AutoCAD 2015 using external vb.net

Anonymous
Not applicable

I have a vb.net 2012 application (external to autocad) that opens autocad, reads thru the dimension layer and sets values, regenerates the drawing and saves to dwg file.  This works fine.  But now I also need to read thru the user parameters and set those values.  I am not finding anything on how to do this.  below is what is being done to get dimensions.  i need to do the same type of thing for user parameters. (note: using interop)

 

Any guidance would be greatly appreciated.  Thanks.

        modelSpace = thisdrawing.ModelSpace


        For Each acadEntity As AcadEntity In modelSpace
            'Our interest is only entities lying Dimension layer
            If [String].Compare(acadEntity.Layer, layerName) = 0 Then
                Entities.Add(acadEntity)
            End If
        Next



        'modify each entity values and names
        For Each entity As AcadEntity In Entities
            Dim dimension As AcadDimension = TryCast(entity, AcadDimension)
            If dimension IsNot Nothing Then
                Dim dimvalue As String = dimension.dimconstrvalue
                Dim dimname As String = dimension.dimconstrname
                Dim dimexpression As String = dimension.dimconstrexpression

'code here to set dim expression
 
                dimexpression = replacementvalue
                dimension.dimconstrexpression = dimexpression
                dimension.Update()
            End If
        Next

 

0 Likes
843 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Dear,

 

I would like to do the same. Have you already found any solution to this problem?

 

Jan

0 Likes
Message 3 of 3

SENL1362
Advisor
Advisor

maybe the AutoCAD command "-DIMSTYLE" is what you're looking for.
-DIMSTYLE<space>Variable<space>ISO-25<space>DIMxxx<space>newval<enter>

-DIMSTYLE<space>Save<space>ISO-25-1<enter>

0 Likes