discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

openscad documentation genereation/libraries

T
Troberg
Mon, May 4, 2020 6:11 AM

I add a comment header, like this (sorry for the Swedish):

/AUTODOC
CAT: 2D-geometri
DEF: ogival2d(d,dcurve,thickness=0)
DESC: Gör en ogival i 2D.
PARAM: d Bredd.
PARAM: dcurve Diamater på kurvaturen.
PARAM: thickness Tjocklek om man gör den ihålig. 0 om den inte ska vara
ihålig.
PARAM: fn Vidarekoppling av $fn.
AUTODOC
/
module ogival2d(d,dcurve,thickness=0,fn=100){
difference(){
intersection(){
xtran(-dcurve/2+d/2)
circle(d=dcurve,$fn=fn);

		xtran(dcurve/2-d/2)
		circle(d=dcurve,$fn=fn);
	}

	if(thickness>0){
		intersection(){
			xtran(-(dcurve-thickness*2)/2+d/2-thickness)
			circle(d=dcurve-thickness*2,$fn=fn);

			xtran((dcurve-thickness*2)/2-d/2+thickness)
			circle(d=dcurve-thickness*2,$fn=fn);
		}
	}

	translate([-dcurve,-dcurve,0])
	square([dcurve*2,dcurve]);
}

}
/ENDAUTODOC/

Then, I made a program which reads the file and imports both metadata and
actual code. In that program, I can search, read docs, and copy the module
definition for easy use.

--
Sent from: http://forum.openscad.org/

I add a comment header, like this (sorry for the Swedish): /*AUTODOC CAT: 2D-geometri DEF: ogival2d(d,dcurve,thickness=0) DESC: Gör en ogival i 2D. PARAM: d Bredd. PARAM: dcurve Diamater på kurvaturen. PARAM: thickness Tjocklek om man gör den ihålig. 0 om den inte ska vara ihålig. PARAM: fn Vidarekoppling av $fn. AUTODOC*/ module ogival2d(d,dcurve,thickness=0,fn=100){ difference(){ intersection(){ xtran(-dcurve/2+d/2) circle(d=dcurve,$fn=fn); xtran(dcurve/2-d/2) circle(d=dcurve,$fn=fn); } if(thickness>0){ intersection(){ xtran(-(dcurve-thickness*2)/2+d/2-thickness) circle(d=dcurve-thickness*2,$fn=fn); xtran((dcurve-thickness*2)/2-d/2+thickness) circle(d=dcurve-thickness*2,$fn=fn); } } translate([-dcurve,-dcurve,0]) square([dcurve*2,dcurve]); } } /*ENDAUTODOC*/ Then, I made a program which reads the file and imports both metadata and actual code. In that program, I can search, read docs, and copy the module definition for easy use. -- Sent from: http://forum.openscad.org/