Changeset View
Changeset View
Standalone View
Standalone View
add_mesh_extra_objects/Blocks.py
| Context not available. | |||||
| def rnd(): return random() | def rnd(): return random() | ||||
| #random number from -0.5 to 0.5 | #random number from -0.5 to 0.5 | ||||
| def rndc(): return (random() - 0.5) | def rndc(): return random() - 0.5 | ||||
| #random number from -1.0 to 1.0 | #random number from -1.0 to 1.0 | ||||
| def rndd(): return (random() - 0.5)*2.0 | def rndd(): return (random() - 0.5)*2.0 | ||||
| Context not available. | |||||
| # init loop variables that may change... | # init loop variables that may change... | ||||
| grt = (SetGrt + rndc()*SetGrtVar)/(self.radius) | grt = (SetGrt + rndc() * SetGrtVar) / self.radius | ||||
| ThisBlockHeight = self.h+rndc()*(1-SetRowHeightLink)*SetGrtVar | ThisBlockHeight = self.h+rndc()*(1-SetRowHeightLink)*SetGrtVar | ||||
| ThisBlockDepth = rndd()*SetDepthVar+SetDepth | ThisBlockDepth = rndd()*SetDepthVar+SetDepth | ||||
| Context not available. | |||||
| ThisBlockDepth = rndd()*SetDepthVar+SetDepth | ThisBlockDepth = rndd()*SetDepthVar+SetDepth | ||||
| if SetGrtVar: # vary grout | if SetGrtVar: # vary grout | ||||
| grt = (SetGrt + rndc()*SetGrtVar)/(self.radius) | grt = (SetGrt + rndc() * SetGrtVar) / self.radius | ||||
| ThisBlockHeight = self.h+rndc()*(1-SetRowHeightLink)*SetGrtVar | ThisBlockHeight = self.h+rndc()*(1-SetRowHeightLink)*SetGrtVar | ||||
| Context not available. | |||||
| avlist[i] = [v0,v1,v2] | avlist[i] = [v0,v1,v2] | ||||
| return (avlist,aflist) | return avlist, aflist | ||||
| # | # | ||||
| def sketch(): | def sketch(): | ||||
| Context not available. | |||||
| RDiff = 0 | RDiff = 0 | ||||
| #Check to see if the edges are close enough toegther to warrant a single block filling it | #Check to see if the edges are close enough toegther to warrant a single block filling it | ||||
| if (InnerDiff < MaxWid): | if InnerDiff < MaxWid: | ||||
| #if this is true, then this row is just one block! | #if this is true, then this row is just one block! | ||||
| x = (LNerEdge + RNerEdge)/2. | x = (LNerEdge + RNerEdge)/2. | ||||
| w = InnerDiff | w = InnerDiff | ||||
| Context not available. | |||||
| bevelR = rightOpening.edgeBev(rowTop) | bevelR = rightOpening.edgeBev(rowTop) | ||||
| bevelBlockOffsets(rightOffsets, bevelR, -1) | bevelBlockOffsets(rightOffsets, bevelR, -1) | ||||
| # check to see if it is only two blocks | # check to see if it is only two blocks | ||||
| if (InnerDiff < MaxWid*2): | if InnerDiff < MaxWid * 2: | ||||
| #this row is just two blocks! Left block, then right block | #this row is just two blocks! Left block, then right block | ||||
| #div is the x position of the dividing point between the two bricks | #div is the x position of the dividing point between the two bricks | ||||
| div = InnerMid + (rndd()*settings['wv'])/r1 | div = InnerMid + (rndd()*settings['wv'])/r1 | ||||
| Context not available. | |||||
| midHalfAngle = atan(v/(r-w/2)) | midHalfAngle = atan(v/(r-w/2)) | ||||
| midHalfAngleBevel = atan(bevHt/(r-w/2)) | midHalfAngleBevel = atan(bevHt/(r-w/2)) | ||||
| bevelAngle = midHalfAngle - midHalfAngleBevel | bevelAngle = midHalfAngle - midHalfAngleBevel | ||||
| anglebeg = (PI/2)*(sideSignInv) | anglebeg = (PI / 2) * sideSignInv | ||||
| angleend = (PI/2)*(sideSignInv) + midHalfAngle | angleend = (PI / 2) * sideSignInv + midHalfAngle | ||||
| avlist,aflist = arch(ra,rt,(xoffset)*(sideSign),zpos,anglebeg,angleend,bev,bevelAngle,len(vlist)) | avlist, aflist = arch(ra, rt, xoffset * sideSign, zpos, anglebeg, angleend, bev, bevelAngle, len(vlist)) | ||||
| for i,vert in enumerate(avlist): avlist[i] = [vert[0]+hole.x,vert[1],vert[2]] | for i,vert in enumerate(avlist): avlist[i] = [vert[0]+hole.x,vert[1],vert[2]] | ||||
| vlist += avlist | vlist += avlist | ||||
| Context not available. | |||||
| #right side top, left side bottom | #right side top, left side bottom | ||||
| #angles reference straight up, and are in radians | #angles reference straight up, and are in radians | ||||
| anglebeg = (PI/2)*(sideSign) - midHalfAngle | anglebeg = (PI / 2) * sideSign - midHalfAngle | ||||
| angleend = (PI/2)*(sideSign) | angleend = (PI / 2) * sideSign | ||||
| avlist,aflist = arch(ra,rt,(xoffset)*(sideSignInv),zpos,anglebeg,angleend,bev,bevelAngle,len(vlist)) | avlist, aflist = arch(ra, rt, xoffset * sideSignInv, zpos, anglebeg, angleend, bev, bevelAngle, len(vlist)) | ||||
| for i,vert in enumerate(avlist): avlist[i] = [vert[0]+hole.x,vert[1],vert[2]] | for i,vert in enumerate(avlist): avlist[i] = [vert[0]+hole.x,vert[1],vert[2]] | ||||
| Context not available. | |||||
| #keystone | #keystone | ||||
| Dpth = settings['d']+rndc()*settings['dv'] | Dpth = settings['d']+rndc()*settings['dv'] | ||||
| Grout = settings['g'] + rndc()*settings['gv'] | Grout = settings['g'] + rndc()*settings['gv'] | ||||
| angleBevel = (PI/2)*(sideSign) - midHalfAngle | angleBevel = (PI / 2) * sideSign - midHalfAngle | ||||
| Wdth = (rt - Grout - bev) * 2 * sin(angleBevel) * sideSign #note, sin may be negative | Wdth = (rt - Grout - bev) * 2 * sin(angleBevel) * sideSign #note, sin may be negative | ||||
| MidZ = ((sideSign)*(bevHt + h/2.0) + z) + (rt - Grout - bev) * cos(angleBevel) #note, cos may come out negative too | MidZ = (sideSign * (bevHt + h / 2.0) + z) + (rt - Grout - bev) * cos(angleBevel) #note, cos may come out negative too | ||||
| nearCorner = sideSign*(MidZ - z) - v - h/2 | nearCorner = sideSign*(MidZ - z) - v - h/2 | ||||
| if sideSign == 1: | if sideSign == 1: | ||||
| Context not available. | |||||