9 Replies Latest reply on Feb 15, 2013 8:33 AM by Mark Bradford

    Hole Favorites

    Mark Bradford

      Since Solidworks API does not allow for Hole Colors based on Feature name. ie .. dowel holes = red  (solidworks Enhancement request  -  SPR 687932)

       

      Is there a way to set hole color based on hole favorites? Where the hole color is assigned based on the Hole favorite name?

       

      Thanks

      Mark

        • Re: Hole Favorites
          Mukesh Prasad

          I don't know about API because I do not use them but I set the color of the Holes by going to Option > System Options > Go to Document Colors (this is in the bottom of the form) then select "Hole" and Edit to whateve color you want.

            • Re: Hole Favorites
              Mark Bradford

              Thanks Mukesh,

                   Unfortunately, that will make all of the holes the same color.   We require colors to be assigned by hole type.

               

              ie. 

               

               

              All dowel holes = Red

              All tapped holes = Orange

              All screw clearance holes = Green

              All Counterbored holes = Blue

              All Countersunk holes = Yellow

               

               

              I Know Solidworks api does not yet support the specific "dowel" feature yet.

              So I was hopeing it could be done by Hole favorite name instead to achieve the same result.

               

              Thanks,

              Mark

            • Re: Hole Favorites
              Keith Rice

              Hi Mark,

               

              In this thread it sounded like you wanted the hole colored base on its type, and we showed you how to do that. Yet it looks like you still don't have you want so could you please share what your ultimate goal is? How would you like a macro to help you reach that goal?

               

              As for hole wizard favorites: I don't see anything in the API that let's you interact with them. Moreover, since no meaningful data can be read out of them when opened in Notepad, I don't think there's a backdoor approach you could take to interacting with them, either.

               

              Keith

              Video Tutorials for the SolidWorks API

                • Re: Hole Favorites
                  Mark Bradford

                  Hi Keith,

                       I the previous thread you provided a great solution for altering the colors of the holes based on its type upon creation.

                   

                  The problem is ... I can't specify the "dowel" hole as red ... because (according to the people at Solidworks), they don't yet support the "dowel" hole in Solidworks api.

                   

                  What I am trying to get, is the holes colored based on its type as follows (see screenshots)

                   

                  All dowel holes = Red    (based on "Hole Type, and type)

                  All screw clearance holes = Green   (based on "Hole Type, and type)

                  All tapped holes = Orange   (based on hole type)

                  All Counterbored holes = Blue  (based on Hole Type)

                  All Countersunk holes = Yellow  (based on Hole Type)

                   

                  I don't want it to matter if its metric or inch ... if its blind or thru ... or anything else.   Only based on the selections shown in the images.

                   

                  I hope this explains it a bit better.   I'm sorry for not bgeing clear from the start,

                   

                  Thanks,

                  Mark

                   

                  Image 001.jpgImage 002.jpgImage 003.jpgImage 004.jpgImage 005.jpg

                    • Re: Hole Favorites
                      Keith Rice

                      Mark Bradford wrote:

                       

                      The problem is ... I can't specify the "dowel" hole as red ... because (according to the people at Solidworks), they don't yet support the "dowel" hole in Solidworks api.

                       

                      I suppose you are referring to the lack of support in the swWzdHoleTypes_e enumeration, which is used by IWizardHoleFeatureData2::Type? Indeed, if you can't determine the type using that property then you may need to determine the type based on some physical criteria. For example, what physically is the difference between a dowel hole and a screw clearance? If a dowel hole has no angled faces, for example, then this could be your criteria to distinguish it from a screw clearance. (I have no idea if that's true about dowel holes, it's just an example.) Tapped holes have a cosmetic thread associated with them, so right there's a criteria that distinguishes a tapped hole. Flat head cap screws have an angled face in their head, socket heads don't, so there's another criteria. Etc.

                       

                      Is there some other member in IWizardHoleFeatureData2 that could provide information that would help you distinguish between the types?

                       

                      Keith

                      Video Tutorials for the SolidWorks API

                      • Re: Hole Favorites
                        Artem Taturevych

                        I think it would be more or less safe to sort the holes by name. The holes are named with the same pattern increasing the counter. Use InStr function to identify whether the hole contains 'Dowel', 'Screw', 'Tapped', etc. to recognize it. Otherwise Keith's suggestion is more be reasonable.

                        __________________________

                        Regards,

                        Artem Taturevych

                        Application Engineer at Intercad

                        http://intercad.com.au/

                        Tel: +61 2 9454 4444

                          • Re: Hole Favorites
                            Mark Bradford

                            Thanks guys.

                               It looks to me that the Counterbored Holes, Countersunk Holes, and Tapped holes, aren't really an issue.   swWzdHoleTypes_e Enumeration seems to allow for these.

                             

                            The issues then would only be the Screw Clearance holes, and the Dowel Holes.

                             

                            I don't see anything that would distinguish between the 2 different types.

                             

                            I wasn't aware of Artem's suggestion about hole naming, but I'm not sure that would work upon hole creation, and macro might have to be ran after the holes are inserted?   I really dont know much about it.

                             

                             

                            Mark