GC ImageUVSampler

Ralf Lindemann was so kind to publish his UVSampler Script for GC. It’s an easy way to create some 2d and 3d patterns.

 

// Bentley GenerativeComponents Transaction File — File structure version 1.08. (Please do not delete or change this line.)

environment
{
GCVersion = ‘08.11.08.260’;
MSVersion = ‘08.11.07.443’;
MSProject = ‘GC_Default’;
MSDesignFile = ‘C:\Users\Eike\Dropbox\4_Research\130323-RGB\130326-circles.dgn’;
}

transaction graphChange ‘Add x, y’
{
feature User.Objects.y Bentley.GC.Features.GraphVariable
{
Value = 100;
}
feature User.Objects.x Bentley.GC.Features.GraphVariable
{
Value = 100;
}
}

transaction graphChange ‘Add imageUVSampler01’
{
feature User.Objects.imageUVSampler01 User.imageUVSampler
{
ArrPtsX = Series(0,x-1,1);
ArrPtsY = Series(0,y-1,1);
GridH = x;
GridV = y;
ImagePath = ‘.\\mona-bw.jpg’;
Replication = ReplicationOption.AllCombinations;
}
}

transaction graphChange ‘Add excelRange01’, suppressed
{
feature User.Objects.excelRange01 Bentley.GC.Features.ExcelRange
{
RangeAddress = ‘A1:DD100’;
SheetName = ‘mona’;
Value = imageUVSampler01.lum;
WorkbookFileName = ‘mona01’;
}
}

transaction graphChange ‘Add Circles1’, suppressed
{
feature User.Objects.point01 Bentley.GC.Features.Circle
{
Function = function (imageUVSampler uv)
{
Circle c = {};
double d = 1;
double r = 1;
double s = 4;

for (int i = 0; i < uv.Count/r; ++i)
{
c[i] ={};
for (int j = 0; j < uv[i].Count/r; ++j)
{
Point pt = new Point();
pt.ByCartesianCoordinates(baseCS,i*r,-j*r,0);

double x = 1-uv[i*r][j*r].lum;
//breakpoint;
c[i][j] = new Circle(this);
c[i][j].ByCenterRadius(pt,Series(d/s,x*d,d/s),baseCS.XYPlane);
}
}
return c;

};
FunctionArguments = {imageUVSampler01};
}
}

transaction graphChange ‘Add Circles2’, suppressed
{
feature User.Objects.point01 Bentley.GC.Features.Circle
{
Function = function (imageUVSampler uv)
{
Circle c = {};
double d = 1;
double r = 2;
double s = 5;

for (int i = 0; i < uv.Count/r; ++i)
{
c[i] ={};
for (int j = 0; j < uv[i].Count/r; ++j)
{
Point pt = new Point();
pt.ByCartesianCoordinates(baseCS,i*2,-j*2,0);

double x = 1-uv[i*r][j*r].lum;
//breakpoint;
c[i][j] = new Circle(this);
c[i][j].ByCenterRadius(pt,Series(d,d-x*d,d/s),baseCS.XYPlane);
}
}
return c;

};
FunctionArguments = {imageUVSampler01};
}
}

transaction graphChange ‘Add Circles3’
{
feature User.Objects.circle01 Bentley.GC.Features.Circle
{
Function = function (imageUVSampler uv)
{
Point pt = {};
Circle cir = {};
for (int i = 0; i < uv.Count; ++i)
{
pt[i] ={};
cir[i]={};
for (int j = 0; j < uv[i].Count; ++j)
{
pt[i][j]=new Point();
pt[i][j].ByCartesianCoordinates(baseCS,i,-j,0);
cir[i][j] = new Circle();
cir[i][j].ByCenterRadius(pt[i][j],1-uv[i][j].lum,baseCS.XYPlane);
}
}
return cir;

};
FunctionArguments = {imageUVSampler01};
}
}

About eikeschling

Architect - Computational Design Assistant - Chair of Structural Design Technische Universität München

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: