Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Repeat 2d Object

Anonymous
Not applicable
I have attached a screenshot of a 2d symbol which, when I draw it beyond its length, I would like it to repeat (like the 2d insulation object in archicad.)

As you can probably guess, the 2d script so far is a cleaned up automated script straight out of archicad. Would anyone be able to give me some guidance on how to go about scripting the object to loop?

My understanding is that I would FOR... NEXT loop and get the object to repeat if I set it out longer than its length but, after studying other objects and looking around online, I still don't really know where to start!

Ive posted the basic code below:


mul2 A/0.107482, B/0.019122
add2 -59.16268087103, 96.73000278751
pen 6
set fill "Solid Fil1"
poly2_b{5} 5, 3, 0, 3, 120, 0,
0, 0, 1, 0, 0, 1, 0,
59.16268087103, -96.71088119978, 1,
59.2155617965, -96.71088119978, 1,
59.2155617965, -96.73000278751, 1,
59.16268087103, -96.73000278751, 1,
59.16268087103, -96.71088119978, 1
set fill "Solid Fil1"
poly2_b{5} 5, 3, 0, 3, 81, 0,
0, 0, 1, 0, 0, 1, 0,
59.2155617965, -96.71088119978, 1,
59.27016330366, -96.71088119978, 1,
59.27016330366, -96.73000278751, 1,
59.2155617965, -96.73000278751, 1,
59.2155617965, -96.71088119978, 1
set fill "Solid Fil1"

Thanks,
Richard

Screen Shot 2012-03-12 at 16.41.07.png
1 REPLY 1
Anonymous
Not applicable
Hello,

Here is one piece of code that should work. You can put it
all in the master script - alternatively could be splitted between
value and 2D scripts.

Hope this makes sense, example object attached.



 
!--needed new parameters are present in the example object

!--master or value script 
values "grid" 1, range[0.1, ] 
values "a" grid, range[grid, ] step grid, grid 
values "b" 0.1 
!-- 
 
 
!--master or 2D script 
eps= 0.0001 
 
pen L_ 
 
parts= int((a+eps)/grid) 
for xx=1 to parts 
	if fra(xx/2) then	!--odd round 
		fillpen= pen_1 
		fill fill_1 
	else				!--even round 
		fillpen= pen_2 
		fill fill_2 
	endif 
	 
	poly2_a 4, 1+2+4, fillpen, 
		0,	0,	1, 
		grid,	0,	1, 
		grid,	b,	1, 
		0,		b,	1 
 
	add2 grid, 0 
next xx 
del xx 
!-- 




Regards, Juha