cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Making complex hole patterns

SOLVED
Highlighted

Re: Making complex hole patterns

Change the pattern type to Identical (whatever the name is now). The default General type allows for pattern members to intersect each other, so each member check on all previous members for possible intersection. Slows things to a crawl.

Not sure what a pcd is.

What is the purpose of modeling the holes? A CNC macro would work better to produce the holes.

Re: Making complex hole patterns

Hi Martin,

Thanks for your great idea.

This saves us a lot of time.

Greetings Peter

Highlighted

Re: Making complex hole patterns

With a couple of other functions this can create the file directly. No need to edit.

In the attached I've added a macro called 'new_gen'. Just select the rows with the X, Y, Quantities and then run the macro. It isn't even necessary to select all the columns; just make the selection cover the desired rows. Some day I'll figure out how to select offsets within the selection. Sigh.

It prompts for a directory to write the file and then prompts for the name. If you don't enter a name it calls it points.ptb. If you don't add the suffix, it adds '.ptb.'

The output carries the full accuracy of the coordinates, though I don't know if it is required or beneficial.

Highlighted

Re: Making complex hole patterns

Hi David,

Thanks for the new Macro, it works fine.

Only i don't get the file name wright, everything i give in in the window the macro overwrite it with points.ptb.

But that is a minor problem.

Greetings Peter

Highlighted

Re: Making complex hole patterns

Peter,

there is little typo in macro called 'new_gen'.

Replace ... If Filename = "" Then File_name = "points.ptb"

with ... If File_name = "" Then File_name = "points.ptb"

MH


Martin Hanák
Highlighted

Re: Making complex hole patterns

Thanks Martin; it was a very frustrating effort to get the cell reference to work MS Excel help is no help at all and it seemed to work otherwise; I should have used Option Explicit, but one of the 'Help' functions that doesn't help is that it doesn't show what all the function return types are. Sigh. 

I also found that there could be some internationalization that would help if commas are a problem.

Look for the Application.International Property (Excel)

which returns (among a lot of other interesting results) the characters for the:

xlDecimalSeparator: String Decimal separator

and

xlThousandsSeparator: String Zero or thousands separator.

The following shows the functions used to determine what symbols are being used and change the A1 cell text contents.

MrExcel Message Board

Private Sub CommandButton1_Click()

    Dim DecSep As String

    Dim ThouSep As String

    DecSep = Application.International(xlDecimalSeparator)

    ThouSep = Application.International(xlThousandsSeparator)

    If DecSep = "." Then

        Range("A1").Value = TextBox1.Value

    Else

        Range("A1").Value = WorksheetFunction.Substitute(TextBox1.Value, DecSep, ThouSep)

    End If

End Sub

Announcements
Message from Brian Thompson (PTC General Manager and DVP) regarding Creo Business Continuity plans.