Programming Challenge No. 12

Programming Challenge No. 12

john.uhden
Mentor Mentor
2,083 Views
36 Replies
Message 1 of 37

Programming Challenge No. 12

john.uhden
Mentor
Mentor

That's right boys and girls.

We are bypassing Challenge Nos. 5, 6, 7, 8 ,9 , 10, and 11 in favor of the 12th month of the year because that's when Christmas comes!

Digging back into history, it was in 1997 that the great Dietmar Rudolph challenged us to build a Christmas tree using AutoLisp.  Of course he included some rule about it being no more that 47 somethings long, which only his own was that short.  And his function created a very artistic tree.  I'm ashamed that I never kept a copy.  But I have kept a copy of my own entry, to which he gave honorable mention.  I have attached the file to inspire you all to do a better job than I.

Unlike Dietmar's rule, there is no limit to the amount of code you may create in your function, but everything must be created within the code.  No references to external anythings are allowed.  In fact each entry will consist of just one (1) AutoLisp file.  The use of Visual Lisp is just fine.  There will be no time trials.  In fact you might want to throw in some delays to slow down your creation to enjoy it more  (I should have done that).

Let's try to have all the entries in by Sunday, Dec. 19, so we can enjoy them all before Christmas day.  Maybe you can teach me how to make one of those video thingies that I can send to my children and theirs.

CAUTION:  Run my code only in an empty drawing because it erases everything.

John F. Uhden

2,084 Views
36 Replies
Replies (36)
Message 2 of 37

john.uhden
Mentor
Mentor

I trust that you artists are working diligently to surprise us with your AutoBeauty.

I've been thinking about adding presents under the tree to mine.  I would love to add red ribbons but have no idea how to emulate folds and knots.  Hmm, maybe if I can draw one I can do entgets to know what to entmake, but 3D thingies are beyond my expertise.  So they will end up looking like they were ironed flat when you do a 3DOrbit.  But you can make a shpere in AutoCAD, right?  Ahah... the SPHERE command!  Drat, there is no RIBBON command, at least not in 2002. ☹️

John F. Uhden

0 Likes
Message 3 of 37

CodeDing
Advisor
Advisor

@john.uhden ,

 

Cool tree! I have NO idea how you made those circles for the candles lol.

wmv1 (2).gif

 

Best,

~DD

0 Likes
Message 4 of 37

john.uhden
Mentor
Mentor
@CodeDing
I'm just a little thick.

John F. Uhden

Message 5 of 37

Sea-Haven
Mentor
Mentor

I know I did a tree with a height and max width but a random pattern of leaves/block, it used Lee-mac random number code to set a number of values, made a nice 3d tree/bush, trying to find code was like 30 years ago. Something like this but way better. Will try to find time and redo the code.

SeaHaven_0-1638753737460.png

The simplest 3 objects.

SeaHaven_1-1638753894970.png

 

0 Likes
Message 6 of 37

john.uhden
Mentor
Mentor
So find it!

John F. Uhden

0 Likes
Message 7 of 37

Sea-Haven
Mentor
Mentor

Still looking for it. I think will have a go at recreating. I think its on a 30 year old company server.

 

Thought about making a color change light using a dynamic solid block etc with various colors set say white r g b loop through them and go next visibility once exceed 4 reset to 1, randomly set visibility when inserting. Say replace the candle in your tree or add as the flame.

 

I dont do much with dynamic blocks so learning. learning about visibility states. Hope to have something soon.

 

0 Likes
Message 8 of 37

rgrainer
Collaborator
Collaborator
Accepted solution

Note: this card/routine is not by me but by CJ Follmer (that what it says in the header)
CMASCARD.LSP2005By CJ Follmer

I may have modified it to suit my purpose. Don't remember if it works, but here it is anyway. File is named cmascard, main function renamed to xmascard

Message 9 of 37

john.uhden
Mentor
Mentor
That's so sad to hear.
I despise colored and blinking lights. 😕

John F. Uhden

0 Likes
Message 10 of 37

ronjonp
Mentor
Mentor

@john.uhden  Very nice!

ronjonp_0-1638902296533.png

 

Message 11 of 37

Kent1Cooper
Consultant
Consultant
Accepted solution

Here's my take on it.  [And it fits Dietmar's rule if "somethings" were lines of code -- 45 lines!]

Kent1Cooper_0-1638982549245.png

 

Kent Cooper, AIA
Message 12 of 37

CodeDing
Advisor
Advisor

@Kent1Cooper ,

 

Wow, that looks great also for such simple code! (I used the Shaded view style here, personal preference)

wmv1_1.gif

Message 13 of 37

Kent1Cooper
Consultant
Consultant

I like "Realistic" better, for the glint on the ornaments.  Here's what I get with "Shaded"

Kent1Cooper_0-1638985273175.png

whereas "Realistic" gives me this:

Kent1Cooper_1-1638985318546.png

One could get shinier by actually assigning materials, and rendering....

Kent Cooper, AIA
0 Likes
Message 14 of 37

john.uhden
Mentor
Mentor

@Kent1Cooper 

I am excruciatingly impressed!

Hopefully many others will enjoy it as much.

It looks like a Douglas Fern to me.  I like the conical shape.

John F. Uhden

0 Likes
Message 15 of 37

Kent1Cooper
Consultant
Consultant
Accepted solution

Here's an enhanced version [with a few more lines of code].  If the view style is set to Realistic instead of the default 2D Wireframe first, you can watch it work as it constructs things, and it now also takes the 3D point of view first, which is more interesting than watching that in plan view.  And I put in spinning of the viewpoint after it's done [hit ESCape to end it].

Kent Cooper, AIA
Message 16 of 37

john.uhden
Mentor
Mentor

NICE! @Kent1Cooper 

But I think SHADEMODE;Shaded looks more "realistic."

If that spring looking thing is a helix, you ought to make it invisible.

I violated your code.  Yes, much better.

But why is the topmost red ball pulsating?  Can you make it blow up into pieces?

Can you make a squirrel come out of the tree, like Clark Griswold's (or was that the cat)?  No, I think the cat got electrocuted.

Can you make the needles all fall to the floor just like a real tree?

John F. Uhden

0 Likes
Message 17 of 37

Sea-Haven
Mentor
Mentor
Accepted solution

Great job on the tree Kent that is what I was thinking of the "Ornament". Please note Bricscad has a couple of hiccups but still runs just leaves don't get made correct.

 

John I like blinking lights try christmastree2. Fixed value repetitions.

 

OOH explode tree selection set ss2 and rand hor & ver angle & dist. Christmastree3 ?

 

 

Message 18 of 37

Sea-Haven
Mentor
Mentor
Accepted solution

OOH explode tree 

Message 19 of 37

Sea-Haven
Mentor
Mentor

I was hoping some one would crash Rudolph the reindeer in to the tree.

0 Likes
Message 20 of 37

john.uhden
Mentor
Mentor
I've got some time left, but know nothing about animation (like legs
running). Can he be on a skateboard? How do you make a graphic explosion?
Ohno, wait... He would be falling out of the sky, right? T'would be real
cool if he were tumbling head over heels with his nose blinking.
I did build a "flicker" function that might work. I just wanted my candle
flames to be flickering, but randomly. So I've been devising a "shufffle"
function to mix up the order of all the flame entities. Haven't written a
stitch of code for it but I was thinking that I could split the list in
halves, reverse one of the halves and then reassemble them via consing each
other's car. I dunno, something like that.
Hey, for the first time in about 40 years I got a decent Christmas bonus,
so we're having filet tonight (USDA prime). Last night I made shrimp (aka
prawns) with artichokes and served over linguini with a lot of sauce. I'll
post the recipe if anyone wants.

John F. Uhden

0 Likes