I am fairly new to VBA customization of AutoCAD and need some assistance.
I am trying to modify the .LinearScaleFactor of different types of dimensions in a drawing using VBA.
I am having an issue with properly filtering for the types of dimensions that require this change.
I have narrowed it down to needing to filter the selection set for the list of different types of dimensions below but am unsure of how to approach it.
AcadDimAligned
AcadDimArcLength
AcadDimDiametric
AcadDimOrdinate
AcadDimRadial
AcadDimRadialLarge
AcadDimRotated
I have tried using the filter (0 . "Dimension") but this selection set does not allow me to change the .LinearScaleFactor I am assuming because there are some dimension types which do not have this property.
There is likely a simple way of doing this but I am not seeing it.
If you need any further information, please let me know. Thanks.
Solved! Go to Solution.
Solved by RICVBA. Go to Solution.
after creating and populating your selectionset you could iterate through it like follows (where i assumed "SSet1" as the name of your AcadSelectionSet object)
Dim element As AcadEntity For Each element In SSet1 If (TypeOf element Is AcadDimAligned _ Or TypeOf element Is AcadDimAngular _ Or TypeOf element Is AcadDimArcLength _ Or TypeOf element Is AcadDimDiametric _ Or TypeOf element Is AcadDimOrdinate _ Or TypeOf element Is AcadDimRadial _ Or TypeOf element Is AcadDimRadialLarge _ Or TypeOf element Is AcadDimRotated) _ Then element.LinearScaleFactor = 10# Next element
or, in a more roughly (and somehow more elegant as well!) way
Dim element As AcadEntity On Error Resume Next For Each element In SSet1 element.LinearScaleFactor = 10# Next element On Error GoTo 0
the first way you can also have more control over a specific dimension type, adding code to handle different linear scalefactors for each different dimension type
the second way you don't bother of what dimension type you might have collected in your selectionset and simply switch off normal error handling just passing it by thus executing the linearscale instruction only on objects supporting this property
hope this is what you need
bye