Cheical structures

If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
aaronstj
Posts: 66
Joined: Wed Jul 06, 2005 11:34 am
Location: Seattle

Cheical structures

Post by aaronstj »

Ok, I'm really proud of this one. It's inspired by LaT3x's CHEMICAL, which is amazingly cool. I wanted to expirment with a non-organic CDFG, and I thought generating chemical structures would be a cool idea. I hade benzene rings in there, but I couldn't get them to look very good in the structure. I also wanted to put in actual letters for atom names ('c', 'o', and 'h', really, the organic ones), but the random rotation made them look not so good. PLease feel free to play with the code, and post your results.

Image

Code: Select all

startshape node

rule branch 5{
	bond {}	
	node { y 3 }
}

//FREE ELECTRONS
rule branch {
	CIRCLE {s .2 y .75 x -.2}
	CIRCLE {s .2 y .75 x .2}
}

//SINGLE BOND
rule bond{
	line8 { y 1.5 r 90 }
}

//DOUBLE BOND
rule bond {
	line8 { x .2 y 1.5 r 90 }
	line8 { x -.2 y 1.5 r 90 }	
}

rule node 2 {
	atom {}
	branch { r 60}
}

rule node 2 {
	atom {}
	branch { r -60}
}

rule node {
	atom {}
	branch { r -60}
	branch { r 60 }
}

rule node .1 {
	atom {}
}

rule atom {
	CIRCLE {}
	CIRCLE { b 1 s .8 }
}

rule line2 {
	SQUARE { x -.25 size .5 }
	SQUARE { x .25 size .5 }
}

rule line4 {
	line2 { x -.25 size .5 }
	line2 { x .25 size .5 }
}

rule line8 {
	line4 { x -.25 size .5 }
	line4 { x .25 size .5 }
}

User avatar
LaT3x
Posts: 68
Joined: Wed Jul 06, 2005 3:11 pm
Location: Madrid, Spain

GREAT!

Post by LaT3x »

Fantastic!!!
I love it :)

Post Reply