I have a drawing that was created in AutoCAD. When saved as dgn it retains some linetypes from AutoCAD such as Continuous and DGN Style 2. I would like to select these objects and change their linetype. For example, select everything with a Continuous linetype and change them to linetype 0. Then select everything with linetype DGN Style 2 and change them to linetype 2, etc.
Is this possible using VBA? Can somebody help? My knowledge of VBA is very very limited
Many thanks in advance for your help
Have you checked/considered the Options available in the Save as window (Click the Option button).
You could set up a .csv remapping table to convert the AutoCAD line types to MicroStation line styles.
For more information, see the Help>Contents of your product.
Have a look at this link:
I hope this is of help to you.
Many thanks for your reply.
I have checked this option and I am using it. However, there are objects (such as text objects) that do not change by using the csv remapping table. For these objects I need the VBA routine. It is a bit difficult at the moment (for me anyway since I have very limited knowledge of VBA) to change the linestyle of text since in the properties of the text there is no string "LineStyle".
There may be a way to do this without having to program anything. Could you provide an example file (and possibly the source DWG... just put them both in a ZIP or RAR file and attach that to a reply... click on "Use rich formatting" and then select the Options tab)?
Thanks for the reply. Attached is a test drawing. It includes text with linestyle Continuous and text with linestyle DGN Style 2.
I have tried the macro recorder but it doesn't work (I go to Edit->Select by Attributes and select everything with continuous and then change the linestyle. Then everything with DGN Style 2 and change the linestyle).
As I wrote above, I also tried the remapping options via csv but this didn't work either.
Thanks for the help
Try running these commands (in sequence):
mdl silentload selectbyselectby type noneselectby type textselectby style onselectby style DGN Style 2selectby executechange element extendedactive style Continuousset item toolsettings useactiveattributes=1set item toolsettings changestyleenable=1xy=#NULL
If that works for your particular situation, you could "script" that... or queue up the commands in a VBA macro.