Issue:
i am trying to find command to delete specific attribute and another command to add specific attribute on a specific Tag set for more than 100 files (it will take alot of time if i open file by file and make these editing in each file)
i use record macro but i cant found the command of deleting attribute or adding attribute
this is the command to open tag set (CadInputQueue.SendKeyin "MDL SILENTLOAD TAGS DEFINE")
can any one help me ?
the below two picture to illustrate what i want.
Hello DMA,
I am attaching a code that you can add in a new MVBA module and check if it helps. Please open ABD in Administrator mode.
Please note that there are some notes within the attachment. Please follow them and add the codes as per your requirement.
'Add a new Tag Dim newtagsets As TagSets Set newtagsets = MicroStationDGN.ActiveDesignFile.TagSets Dim newtagset As TagSet 'The following statement is to add a new tag set within which a new tag definition will be created 'To create new tag definition in an existing tag set 'change the <tagset name> with the actual tag set name and uncomment 'the following line and comment the next line 'Set newtagset = newtagsets.item("<tagset name>") Set newtagset = newtagsets.Add("NewTagSet1") Dim NewTagDefs As TagDefinitions Set NewTagDefs = newtagset.TagDefinitions Dim newTagDef As TagDefinition Set newTagDef = NewTagDefs.Add("NewTagDef1", msdTagTypeCharacter) newTagDef.Prompt = "This is a new Tag" 'Remove existing Tag with name NewTagDef1 Dim TagSets As TagSets Dim TagSet As TagSet Dim TagDefs As TagDefinitions Dim TagDef As TagDefinition Dim i As Integer Dim j As Integer Dim k As Integer i = 1 k = 1 Set TagSets = MicroStationDGN.ActiveDesignFile.TagSets 'if a tagset name is not known use the following For Each Item In TagSets Set TagSet = TagSets.Item(i) Set TagDefs = TagSet.TagDefinitions j = TagDefs.count For k = 1 To j Set TagDef = TagDefs.Item(k) If TagDef.Name = "NewTagDef1" Then TagDefs.Remove (k) End If k = k + 1 Next i = i + 1 Next 'if a tagset and Tag set name is known 'uncomment the following and put the name of the tag set in place of <TagSet Name> and 'comment the from Dim TagDef as... to ...i= i+1 Next 'Set TagSet = TagSets.Item("<TagSet Name>") 'Set TagDefs = TagSet.TagDefinitions 'TagDefs.Remove("<TagDef Name>")
Satadal.
Answer Verified By: DMA
thanks for your help.
i put the code in attached macro but give me DebugEdit_Tag.rar
DMA,
Two types of code are mixed in there and the names of the Tag sets and Tag definitions are hard coded there. Please change the names as per your requirement and use the code for adding a new tag and removing existing tag in two different sub procedures.
A few bits of code are also comment blocked which are to be unblocked at particular situations. These situations are also given as comments just preceding those pieces of the code. Please go through the comments before running.
Please let me know if this helps.