PDA

View Full Version : Need Help to modify this Macro



engincode
06-13-2019, 02:46 PM
Hello everyone,

This is turning out harder to explain what I want than I anticipated, please ask me questions if I'm unclear.

The "Main.PT_REL" is the macro I'd like to have modified:
1. Currently, the macro takes what's populated in the "PT REL" tab and mirrors them by the value in column C.
1a. The code mirrors by the value in column C, and add's an "L-" and an "_L" which yields L/R-...insert Base Name here..._L/R and the new coordinates are essentially the mirror of the Y points and Z points.
2. The output is 28 total lines in the program I'm using. I only want one set.

Simply, I don't want any mirrors, and no prefix "L- or R-" and no suffix "_L or _R". Just the output with the Base Name (Column A) and the rest of the columns as the macro already does. The output is 3 extra copies of what I'd like.

I'm not sure if it's clear in the code as I'm not well versed in VBA yet. I was hoping to have some help. If I need to explain something more specifically please ask. The original creator is unavailable to modify this for me. Thanks so much everyone.

Respectfully,
D

p45cal
06-14-2019, 04:33 AM
What is 'one set'? Is it as if there were only one row of data in the table at the top of the sheet PT REL?

Eg. this is what's produced in the clipboard if only one line is processed - is it correct?:
*TDN-PROFILE ; Tendon Profile
NAME=L-S9_GD_1LB_L, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO
NAME=L-S9_GD_1LB_R, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO
NAME=R-S9_GD_1LB_L, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO
NAME=R-S9_GD_1LB_R, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO

*USE-STLD, Prestress
*TDN-PRESTRESS
L-S9_GD_1LB_L, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress
L-S9_GD_1LB_R, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress
R-S9_GD_1LB_L, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress
R-S9_GD_1LB_R, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress

If this is not the case, then edit the above output to show what you do want for just that base name S9_GD_1LB

engincode
06-14-2019, 09:17 AM
What is 'one set'? Is it as if there were only one row of data in the table at the top of the sheet PT REL?

Eg. this is what's produced in the clipboard if only one line is processed - is it correct?:
*TDN-PROFILE ; Tendon Profile
NAME=L-S9_GD_1LB_L, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO
NAME=L-S9_GD_1LB_R, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO
NAME=R-S9_GD_1LB_L, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, 0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO
NAME=R-S9_GD_1LB_R, 0.6in PS Strand, 13113to13124, 0, 0, ROUND, 2D
Frame 2, Auto2,,,YES,8
ELEMENT, END-I, 13113, I-J
0, YES, 0, 0
Y=0, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Y=45, -0.973958333333333, NO, 0, 0, NONE,,,,NO
Z=0, -3.79166666666667, NO, 0, 0, NONE,,,,NO
Z=45, -3.79166666666667, NO, 0, 0, NONE,,,,NO

*USE-STLD, Prestress
*TDN-PRESTRESS
L-S9_GD_1LB_L, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress
L-S9_GD_1LB_R, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress
R-S9_GD_1LB_L, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress
R-S9_GD_1LB_R, FORCE, BOTH, 43.9375, 43.9375, 0, Prestress

If this is not the case, then edit the above output to show what you do want for just that base name S9_GD_1LB

------------------

Hi p45cal, thank you for your response and time. That is correct when only one line is populated in the Base Name column, this output is what I'd like to be modified in the following way:

I've bolded and turned red the part of the output that I would like removed. So for the Base Name S9_GD_1LB, I'd only like the first "Name =..." part of the output and the "Prestress..." part in the bottom; essentially the part I didn't turn Bold Red I would like to keep, but without the prefix "L-" and suffix "_R".

When I had said one set I should have quoted this output like you had to show that for this one item under Base Name column, it pops out 4 versions of it as you can see here.

Thank you so much for your time and assistance p45cal!

p45cal
06-14-2019, 02:34 PM
In the attached is a new button at cell L23 of the PT REL sheet.
First, realise that I don't know what this is all about, so I've probably got something wrong.
I copied the PT_REL macro, called it PT_REL2 and made a few small tweaks (see comments in the code), so you can still run the original with the orginal button.

Important:
While testing, I only had one line in the top table on the PT REL sheet and clicking the button (both buttons) it threw an error before I'd made any other changes at all.
Maybe you never have the occasion to use it with only one line of data in the table? Anyway, I've made changes to Function get_array which should put it right - but you may need to check. The changes are commented in that function. The changes make no difference at all if there is more than one line of data in that top table.

engincode
06-14-2019, 04:45 PM
I'll take a look at this, and you're right, the table is usually populated with multiple lines. Thank you again, I'll let you know how it goes on monday :)

I understand the position you're in. The output of this macro creates code to into a bridge design program that lays out the prestressing strands in a bridge girder.

engincode
06-20-2019, 09:47 AM
Hi p45cal, this works perfectly, the only reason it gave a debug error was because one of the inputs under "Element List" wasn't within the range of what elements existed in the other tabs. Thank you so much for this, I can't express fully my gratitude over text. A virtual hug is all I can offer haha