Message 1 of 3
How to get/set user parameters in AutoCAD 2015 using external vb.net
Not applicable
01-22-2015
04:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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