×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API - MacroFeature

API - MacroFeature

API - MacroFeature

(OP)
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.

RE: API - MacroFeature

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

RE: API - MacroFeature

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.

RE: API - MacroFeature

(OP)
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).

RE: API - MacroFeature

>> 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.

RE: API - MacroFeature

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources