Keeping track of where you are in the database is challenging. Here are some
tips.
Two macro functions to know, SEQEL() and SEQBA().
SEQEL() will return the element number of the current insert element
displayed in the insert bar.
SEQBA() will tell you if your current setting in the insert bar is "Before"
or After" the current insert element.
SEQBA()=0 Insert before
SEQBA()=1 Insert after
For example, to keep track of the element number of the element just
created:
If the value of SEQBA()=0, (insert before) then the element just created
always equals the value of SEQEL()-1.
If the value of SEQBA()=1, (insert after) then the element just created
always equals the value of SEQEL().
IF(SEQBA=0)
#ELEM=SEQEL()-1
ELSE
#ELEM=SEQEL()
ENDIF
This will not however work in the example Gary Sent. His example uses the
"LEAD_IN" macro command. The lead in will by-pass the insert sequence
functions and append elements to the start and/or end of a profile. For his
example I recommend grouping the "profile" by selecting a known element in
that profile. Then using the GRP() function to extract the element number.
The GRP() function can be used in various ways
GRP(0) will return a count of how many elements are in the current active
group.
GRP(1) will return the element number of the first element in the current
active group.
GRP(2) will return the element number of the second element in the current
active group.
GRP(3) will return the element number of the third element in the current
active group, etc...
GRP(GRP(0)) will return the element number of the last element in the
current active group.
In Gary's example, immediately after the lead in is created, it will be made
the first element in the selected group. That element number will then be
returned using the GRP(1) function.
VAR_REMOVE_ALL[]
#elmt=GRP(1)
LINE[XE=STX(#elmt), YE=STY(#elmt), ZE=STZ(#elmt), AN=0, DS=10, SE=2, SS=2]
LEAD_IN[EL=#elmt, AN=45, DS=1, LC=0, TY=0, CS=0, RP=0, MO=0]
NEW_GRP[]// remove any elements currently in the active group
PROF_GRP[AR=0, EL="#elmt"]// group a profile by identifying a elemet in that
profile
#ELEM=GRP(1)// extract the element number of the first element in the
current active group
NEW_GRP[]// remove all elements from the active group
PROF_SEQ[BA=0, EL="#ELEM", ME=1]
UEVENT[XS=STX(SEQEL()), YS=STY(SEQEL()), LV=STZ(SEQEL()), TX="@CMPL"]
=================================================
Fred Lauzus, CAM Programming Coordinator
High Steel Structures, Incorporated
mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.highsteel.com <http://www.highsteel.com/>
==================================================
-----Original Message-----
From: gary [mailto:[EMAIL PROTECTED]
Sent: Monday, March 03, 2003 5:33 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [mfg-smartcam] macro question
Thank you for your help.
I have a question. How do you create a element before the last one you just
created. Below is the beginning of my macro. It dose not work properly
because it dose not insert the comment in the right place.
Any help would be appreciated.
VAR_REMOVE_ALL[]
#elmt=GRP(1)
LINE[XE=STX(#elmt), YE=STY(#elmt), ZE=STZ(#elmt), AN=0, DS=10, SE=2, SS=2]
LEAD_IN[EL=#elmt, AN=45, DS=1, LC=0, TY=0, CS=0, RP=0, MO=0]
PROF_SEQ[BA=0, EL="#ELEM", ME=1]
UEVENT[XS=STX(SEQEL()), YS=STY(SEQEL()), LV=STZ(SEQEL()), TX="@CMPL"]
Thank you
Gary
----- Original Message -----
From: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ; [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Sent: Monday, March 03, 2003 9:04 AM
Subject: RE: [mfg-smartcam] macro question
Gary,
The first thing you need to do is find Chapter 6 "Automating SmartCam with
Macros" in the SmartCam Customization Manual on your CD. Print it out. All
the following information and a lot more can be found there.
If you open your macro in a text editor, you will see the various commands
which perform the work. The element will be represented by
EL=yourElementNumber. You need to provide a variable to replace
"yourElementNumber", which can be any combination of integers and letters
preceded by the pound # sign. The macro command VAR_REMOVE_ALL[] will clear
all variables so that you start with a clean slate. Also, you can make use
of the system variable GRP(1), which represents the first element in any
group.
So, to put it all together:
-- Add "VAR_REMOVE_ALL[]" (omit quotes) to the beginning of your macro. Make
it a line by itself. This will clear all variables to start.
-- On another line, add the variable declaration: "#elmt=GRP(1)" (omit
quotes). This will initialize the variable #elmt with the first element in
your group.
-- Next, substitute "EL=#elmt" (omit quotes) for every place you find
"EL=yourElementNumber" This will allow the macro to work with any grouped
element, no matter what its element number is.
Now group your geometry and try running your macro. If it doesn't work and
you can't figure out what's wrong, post it on the forum and someone will try
to help.
Regards,
Chris
-----Original Message-----
From: gary [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 3:24 PM
To: [EMAIL PROTECTED]
Subject: [mfg-smartcam] macro question
I have recorded a macro that performs pretty much what I want.
When I run the macro it modifies the same element # every time.
How can I change that so the macro selects a grouped element or a prompt
allows me to pick a element.
Regards,
Gary
======================================================================
To find out more about this mailing list including how to unsubscribe,
send the message "info mfg-smartcam" to [EMAIL PROTECTED]
======================================================================