Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API - MacroFeature

Status
Not open for further replies.

NorfENG

Mechanical
Aug 26, 2004
2
I have created a macrofeature (VBA) but I don't want to have the user insert more than one. Is there a way to check to see if the macro feature already exists? It is used in a Drawing Document.
 
Replies continue below

Recommended for you

NorfENG,
I do not have an answer, I am just thinking. What is the feature you are placing in the drawing? Does it have a unique feature that you can search for?


Bradley
 
I don't think you can preven multiple instances of a macro featue. However, you should be able to prevent the macro feature from working if it detects an earlier instance of the same feature.
 
Bradley,
I am using the macrofeature to find the last entry in the revision table and insert the information into the appropriate custom properties. PDMWorks can then interface to these custom properties. Using the macrofeature will udate the custom properties with every rebuild so that the drafter does not have to remember to run a macro or to manualy fill in the custom properties to keep them synch'd. Having more than one instance of the macrofeature is unnecessary.

If there was a way to detect an existing instance of the macrofeature then the macro that creates it would skip the part that inserts the macrofeature. I have tried to traverse the feature manager tree but have not had much luck (I'm not an expert VB programmer).
 
>> Is there a way to check to see if the macro feature already exists? It is used in a Drawing Document.

Well, the macro feature is inserted by a macro, isnt it ? Have the Insertion macro parse the feature manager tree, looking for the Feature,getType value.

If you are planning on having more than one
STYLE of macro feature in a document, but only one COPY of any STYLE macro feature, then add an attribute to the macro feature.
 
NorfENG,
I have a macro that checks to see if BOMnumber is blank or a space. If it is a blank or a space then it assigns the number the file is saved as. If it is not blank or space then it is left alone. I hope this helps.

If txtSfBomNumber = " " Or txtSfBomNumber = "" Then
txtSfBomNumber.Text = DrawingNumber ' Required to show BomNumber in text box ' if new model
Else
txtSfBomNumber.Text = BomNumber
End If


Bradley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor