TheSwamp
Code Red => .NET => Topic started by: WOWENS on November 30, 2012, 11:39:27 AM
-
what im trying to do is get the override dimlfac for the selected dimension. i was reading that the override was stored in the xdata my problem is i dont know how to read the xdata. this is what i tried so far but as you can see i dont know what im doing and help would be great.
If AcadObject.GetType.Name.ToUpper Like "*DIMENSION*" Then
Dim MyDim As Dimension = AcadObject
Dim dDimLfac As Double = 0
If MyDim.XData <> Nothing Then
For Each MyTypedValue As TypedValue In MyDim.XData
If MyTypedValue.TypeCode = 1040 Then
dDimLfac = MyTypedValue.Value
Exit For
End If
Next
End If
End If
-
well this is what i ended up with still thinking theres a better way
If MyDim.XData <> Nothing Then
Dim NextLoop As Boolean = False
For Each MyTypedValue As TypedValue In MyDim.XData
If MyTypedValue.TypeCode = 1070 Then
If MyTypedValue.Value = 144 Then
NextLoop = True
End If
ElseIf NextLoop = True And MyTypedValue.TypeCode = 1040 Then
If MyDim.Dimlfac = MyTypedValue.Value Then
dDLF = MyTypedValue.Value
Exit For
End If
End If
Next
End If
-
If you still using AcadApplication this should work too
dim acEnt as acadentity= nothing
.................................................
If TypeOf (acEnt) Is AcadDimension Then
Dim MyDim As AcadDimension = CType(acEnt, AcadDimension)
Dim dDimLfac As Double = New Double
Dim xt As Object = New Object
Dim xd As Object = New Object
MyDim.GetXData("ACAD", xt, xd)
Dim xtype() As Int16 = DirectCast(xt, Int16())
Dim xdata() As Object = DirectCast(xd, Object())
For i As Integer = LBound(xtype) To UBound(xtype)
If xtype(i) = 1040 Then
dDimLfac = CDbl(xdata(i))
Exit For
End If
Next
MsgBox("DIMLFAC is set to " + dDimLfac.ToString())
-
Why not use Dimension.Dimlfac?
It matches whats in the xdata
-
Jeff,
you are correct in some way the problem is this..if you set your dimlfac with the dimension style interface box and dimension something then list it..it shows no dimlfac override but if you set your dimlfac from the command line and then dimension something and list that dimension is shows a dimlfac override. but your right typical you could do that.
-
Fixo,
Im trying to stay away from the AcadApplication when i can. but thank you for the code i will give it a try.
-
well this is what i ended up with still thinking theres a better way
If MyDim.XData <> Nothing Then
Dim NextLoop As Boolean = False
For Each MyTypedValue As TypedValue In MyDim.XData
If MyTypedValue.TypeCode = 1070 Then
If MyTypedValue.Value = 144 Then
NextLoop = True
End If
ElseIf NextLoop = True And MyTypedValue.TypeCode = 1040 Then
If MyDim.Dimlfac = MyTypedValue.Value Then
dDLF = MyTypedValue.Value
Exit For
End If
End If
Next
End If
I still have no idea what you are trying to accomplish, but looking at that I guess your wanting to know if it is "overriden".
You might want to be careful with that approach because as you mentioned changing the dimlfac from the command line it will show a override in list command,
but if you select it and in properties palette change the "Dim Scale Linear" to the same as one defined in style and list it again it will still show as overriden with value matching the styles, if you use a grip edit then list it the overrides will not show up in list.
Depending on when you checked the value your code would
-assign dDLF to overriden value
--assign dDLF to same value as defined in style
---would never reach line to assign dDLF
So maybe the safest bet would be to check if the Dimension.dimlfac equals its DimStyleTableRecord.Dimlfac