Show minimum length of an object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 12:27 AM
I have an object that needs to be restricted to a minimum length. I used a statement in the 2D script(IF A < 2" THEN A = 2") that keeps the object in plan at 2" or more. The problem is that if you type anything less than that in the length box ("A" parameter), that dimension stays the same in the box even though the object itself stays at 2". I'd like the length parameter to revert to the minimum if anything less is typed in.
Thanks in advance,
Doug

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 12:56 AM
Basically:
IF A < 2" THEN A = 2" PARAMETERS A = A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 01:09 AM
That's perfect. I've never (obviously) used the Parameters command. I tried a search and the help files but it's tough when you don't know exactly what you are looking for. It's quite humbling as a novice scripter to have you're big head deflated with something so simple!!

Thanks again,
Doug

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 02:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 05:50 PM
VALUES "A" RANGE [2", ]
It's good to get to know both the PARAMETERS and VALUES functions. There's lots of utility in them.
For example:
VALUES "A" RANGE [2", ] STEP 2", 2"
Does the above and limits A to 2" increments.
You can also stack up the arguments as in:
VALUES "A" RANGE [2", 12"] STEP 2", 2", RANGE [24", 48"] STEP 24", 3"
This will limit the values to 2" increments from 2" to 12" and 3" increments between 24" and 48" (and allow no other values).
Another useful form is:
VALUES "n" 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
It gives the user a pop-up list of predefined values to chose from.
The GDL Reference is rather cryptic on this (and other) topics but worth a look to at least get some hints about what these functions can do.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 06:04 PM
Karl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 10:14 PM
A = min (2", A) ! Master Script
parameters A = A ! Parameter Script
The problem with range values ... Fore sure, they tell you the limits,
But in case of wrong value, they just return to the minimum value.
I find more intuitive to fix the limits myself.
A = min ( max (2", A), 10") ! Master Script
values "A" 2", 4", 6", 10", custom ! Parameter Script
parameters A = A ! Parameter Script
"A" automatically update within the limits, from min to max,
but locks on 2" for any value < 2", and locks on 10" for any value > 10"
That's split hairs, i agree. Whatever method you choose, it's important to use one, for safety.
Supose a typo error. About resolution, you type 3600 instead of 36 (fingers accident).
The object will start infinite loops. At the end, you have to force AC to quit. Too bad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-17 10:50 PM
Range values don't work into arrays.
The parameters method allows a workaround.
!!! --------- Master Script
for k = 1 to nSeg-1
if bStepRot then
for j = 0 to resT
if j = 0 then
if rotE
else
if rotE
endif
next j
endif
next k
!!!-------- Parameter Script
parameters rotE = rotE
In this situation, you can move an angle by increment, into an array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-19 01:24 AM
I understand the "Values" function (thanks again Matthew)but I have to say Oliver, you have officially gone over my head with your last post!

Doug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2008-07-19 09:31 PM

for k = 1 to nSeg-1
for j = 1 to resT
if rotE
next j
next k
Joke aside, this thread just demonstrates AC flexibility.
GDL or not, threre are many ways to achieve what you want.
Cheers,
Olivier