brandalf_the_semiGray Posted December 3, 2019 Posted December 3, 2019 Is it possible to use an if statement of some sort to alter the color of an object in a block? A block I'm making has a bunch of slope data, and based on that slope data I want to change the color of an object to symbolize a pass/fail of sorts. Thanks in advance for any input. Quote
brandalf_the_semiGray Posted December 3, 2019 Author Posted December 3, 2019 I'm leaning towards using vla objects at this point. Quote
ronjonp Posted December 3, 2019 Posted December 3, 2019 Your post is very vague. Perhaps post a sample drawing of before and after of what you're looking for. Short answer is yes .. if statements are very common. The part we're missing about your post is the actual logic required to determine what a pass fail is. Quote
brandalf_the_semiGray Posted December 3, 2019 Author Posted December 3, 2019 Sorry about that. I'm not at a place where I have a drawing completed just yet, but I can post one when I have something like what I'm aiming for I want to supply a routine with upper and lower bounds for slope values. Then, based on the slope values of individual blocks, change the color of a circle in the middle of each block. For example: if(all slopes are in bounds) turn circle green, else turn circle red Quote
ronjonp Posted December 3, 2019 Posted December 3, 2019 Here is a simple example of checking if a number is within a range: (defun _inrange (n ln un) (<= ln n un)) (vla-put-color o (if (_inrange 2 1 2) 3 1 ) ) Quote
brandalf_the_semiGray Posted December 3, 2019 Author Posted December 3, 2019 (edited) 24 minutes ago, ronjonp said: Here is a simple example of checking if a number is within a range: (defun _inrange (n ln un) (<= ln n un)) (vla-put-color o (if (_inrange 2 1 2) 3 1 ) ) Would you be willing to explain the function argument syntax for me? I'm very new to this and not familiar. Thank you EDIT: wait i think i figured it out. The (<= ln n un) could be the one line of the code for the function while the (n ln un) are the arguments correct? Edited December 3, 2019 by brandalf_the_semiGray Quote
ronjonp Posted December 3, 2019 Posted December 3, 2019 54 minutes ago, brandalf_the_semiGray said: EDIT: wait i think i figured it out. The (<= ln n un) could be the one line of the code for the function while the (n ln un) are the arguments correct? That is correct n = number to check ln = low range number un = upper range number 1 Quote
dlanorh Posted December 3, 2019 Posted December 3, 2019 If you make the circle color by block and everything else bylayer the changing the color of the block will change the color of the circle whilst everything else remains the same Quote
Grrr Posted December 7, 2019 Posted December 7, 2019 On 12/3/2019 at 5:29 PM, ronjonp said: Here is a simple example of checking if a number is within a range: (defun _inrange (n ln un) (<= ln n un)) (vla-put-color o (if (_inrange 2 1 2) 3 1 ) ) (setq _inrange <=) (_inrange 2 1 2) >> nil (_inrange 1 2 3) >> T 1 Quote
ronjonp Posted December 9, 2019 Posted December 9, 2019 On 12/7/2019 at 2:24 PM, Grrr said: (setq _inrange <=) (_inrange 2 1 2) >> nil (_inrange 1 2 3) >> T .. there is also that! Quote
Grrr Posted December 9, 2019 Posted December 9, 2019 1 minute ago, ronjonp said: .. there is also that! duh, apologies - I didn't realised that you changed the position of the arguments, due my setq is not the same as your defun. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.