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!

Hole Callouts via VBA? 1

Status
Not open for further replies.

brrian

Mechanical
Jan 21, 2004
164
The Hole Callout feature isn't as flexible as I need it to be. For example, the number of hole instances is shown as "#X" and is always at the beginning of the note. I instead need "# PLACES" at the end of the note.

Also, I need to be able to select from a variety of different notes for a particular hole type. For example, a plain thru hole could get any one of the following notes:

(DIA) DRILL THRU
3 PLACES

(DIA) DRILL THRU & INSERT 1/4-20 PROPELL NUT
ON BACK, 3 PLACES

(DIA) DRILL THRU & INSERT DOWEL PIN
3 PLACES

As it is right now, the Hole Callout feature will not allow you to select from a 'library' of hole notes--it uses the one and only callout that is set up in the calloutformat.txt file.

However, while placing a hole callout, you can choose the "More Properties... Modify Text" function and pretty much edit to your heart's content.

That got me to thinking--could a macro be written that would:

-start the hole callout command
-allow the user to select a hole
-pop up a custom form to allow the user to choose from a list of hole callouts (my custom list)
-populate the hole callout "Modify Text" box with the note chosen in the previous step (either visibly or invisibly)

Any thoughts--can it be done? Hopefully it can. I have a very basic knowledge of VBA, and I'll take a shot at writing something. If anybody has any tips, or could even get me started on the right track, that would be very helpful and extremely appreciated. I'm looking forward to your responses. Thanks,

Brian
 
Replies continue below

Recommended for you

If you do it can I have a copy. This would be a serious help.
 
I'd be more than happy to share. I'm not sure that I'll be able to write it myself.. I've spent some time in the API help, and this might be a bit above my head. I may ask my VAR or another resource to help out.

As long as I know that it can be done, I'll keep you posted on the progress. Thanks,

Brian
 
FYI..."3X" is used, not "3 PLACES".
I agree, this will be a helpful macro.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 2005 SP0.1
 
You mean that "3X" is used in the default notes, right? I found out today that through the "Modify Text" dialog you can change that to whatever you want (3 PLACES for me). In case you didn't know...

Brian
 
I know, SolidWorks made it flexible. But per ASME Y14.5, "3X" is what to use. Anyway, just my 0.02 cents.
If anyone create a macro, I'm interested in trying it.
thanks

Chris
Sr. Mechanical Designer, CAD
SolidWorks 2005 SP0.1
 
I created a similar routine to add prefixes/suffixes to linear dimensions, however, instead of entering the routine after selecting the geometry as you suggested, I enter the routine after selecting the dimension. If you do it this way, you can put a loop in the code which modifies the text for all dimensions which have been selected. This allows you to add the extra text, "(DIA) DRILL THRU, 3 PLACES" to more than one dimension at the same time. There is no extra work in doing it this way because the dimension remains selected after being placed, so you don't have to pick it again before starting the macro.

There may be a problem using the api interface with hole callouts. Using DisplayDimension.SetText() to add a dimension prefix or suffix works fine for standard dimensions. but it does not seem to also work for hole callouts. The dimension textbox expands after the macro is run to add the extra text - when you click and drag the dimension the box which surrounds it is wider than before the routine was run. This suggests that the text was successfully added, but the extra text is not displayed. There does not seem to be a separate function to modify the text in existing hole callouts through the api.

 
I can tell that SolidWorks is trying very hard to conform to major standards, like ANSI (ASME), BSI, DIN, ISO, JIS, etc. Why don't we just try as hard to conform one of the same standard? If you want to do something special, basically you ask for a customed solid modelling software (even if you customize it yourself). I have abandoned my traditional way (by the way, it was a bad way). It works great when you conform the same standard.

Just my 2 cents.

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor