hello, i did use the same kind of technic to create .obj file, that i open and convert in blender.
here is an extern i make to speed things up and exemple how to export to a obj file... (works only with cubes)
cyrille
Claude Heiland-Allen a écrit :
punchik punchik wrote:
Hello, i was experimenting with gem combining diferent generatives techniques to create 3d iterative complex shapes. I would like to use these structures for architecture and I was wondering if its possible to export the generated structures to other 3d modelling software or maybe to autocad, so the structures generated can be built in the real world. Do anybody have tried something like this?
In processing theres a library that allows to export 3d opengl shapes into dxf format that can be loaded in autocad, how difficult can it making something like this in pd? "http://www.processing.org/reference/libraries/dxf/index.html"
I was thinking that it would be possible to iterate over all the repeated geos in each shape and with gem_listinfo extract the information matrix corresponding to each geo, and then store into a text file , then use that info to rebuild the shapes in other program like autocad.
Do anybody have tried something like this?
I did something similar once, but for a special case of 2D with only a small number of [square]s (up to 8 or so). But the principle I used (or that I would use now, if I were doing it again) is basically: wrap each kind of geo in an abstraction, like [cad_square] instead of using [square], that uses the Gemlist info to work out where it is in space, then send a message with that info (plus what kind of geo it is) to a receiver (which might write it to a textfile or do something else with it). Optionally have a pre-render bang and a post-render bang for any headers/footers that the file format needs, and remember that you might need to get colours / materials too (I guess the GEMglVoodoo will do the trick there).
In my case I used pdlua to directly write a graphgrow-engine input file, while using Pd+Gem to generate realtime previews using texture feedback.
A blog post about that: http://claudiusmaximus.goto10.org/cm/2008-03-23_graphgrow_realtime_preview.h...
Some possibly-no-longer-working code: svn export https://code.goto10.org/svn/maximus/2008/gg/ gg
any idea would be aprreciated
I think you're on the right track, but I don't know if there's an existing exporter.
Claude
#N canvas 428 40 774 581 10; #X obj 9 32 _gemwin; #X obj 271 39 gemhead; #X obj 316 195 scaleXYZ 0.9 0.9 0.9; #X obj 316 218 cube; #X obj 316 172 rotateXYZ 20 20 20; #X obj 271 67 scaleXYZ 0.2 0.2 0.2; #X obj 9 217 _light; #X obj 316 147 translateXYZ 2 0 0; #X obj 316 262 cube2obj 1; #X obj 413 543 textfile; #X msg 521 130 clear; #X obj 413 519 list trim; #X obj 475 87 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 383 312 route f v; #X obj 383 287 route list; #X msg 413 470 add v $1 $2 $3; #X obj 413 336 unpack f f f; #X obj 453 404 makefilename %08f; #X obj 413 360 makefilename %08f; #X obj 494 427 makefilename %08f; #X obj 413 446 pack s s s; #X msg 383 494 add f $1 $2 $3 $4; #X obj 316 117 repeat 22; #X floatatom 376 98 5 0 0 0 - - -; #X obj 494 382 + 4; #X text 496 85 <- create a .obj file; #X msg 475 200 write /home/nusmuk/Desktop/test1.obj cr; #X obj 271 94 t b a; #X obj 475 177 delay 1000; #X obj 475 108 t b b b; #X obj 475 227 t a; #X msg 498 151 snap 1; #X msg 271 237 snap 0; #X connect 1 0 5 0; #X connect 2 0 3 0; #X connect 3 0 8 0; #X connect 4 0 2 0; #X connect 5 0 27 0; #X connect 7 0 4 0; #X connect 8 1 14 0; #X connect 10 0 30 0; #X connect 11 0 9 0; #X connect 12 0 29 0; #X connect 13 0 21 0; #X connect 13 1 16 0; #X connect 14 0 13 0; #X connect 15 0 11 0; #X connect 16 0 18 0; #X connect 16 1 17 0; #X connect 16 2 24 0; #X connect 17 0 20 1; #X connect 18 0 20 0; #X connect 19 0 20 2; #X connect 20 0 15 0; #X connect 21 0 11 0; #X connect 22 0 7 0; #X connect 23 0 22 1; #X connect 24 0 19 0; #X connect 26 0 30 0; #X connect 27 0 32 0; #X connect 27 1 22 0; #X connect 28 0 26 0; #X connect 29 0 28 0; #X connect 29 1 31 0; #X connect 29 2 10 0; #X connect 30 0 9 0; #X connect 31 0 8 0; #X connect 32 0 8 0;
PD_DIR = /home/nusmuk/pd/svn/pd/src GEM_DIR = /home/nusmuk/pd/svn/Gem/src
LIBS = -lm
# build flags
INCLUDE = -I$(PD_DIR) -I. -I$(GEM_DIR) -I$(PD_DIR)
CPPFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -ffast-math
-Wall -W -Wno-unused -Wno-parentheses -Wno-switch -g
all: cube2obj.pd_linux square2obj.pd_linux rm -f *.o
.SUFFIXES: .pd_linux
clean: rm -f *.o rm -f *.pd_linux
.cpp.o: g++ $(CPPFLAGS) $(INCLUDE) -o $*.o -c $*.cpp
.cpp.pd_linux: g++ $(CPPFLAGS) $(INCLUDE) -o $*.o -c $*.cpp gcc -export_dynamic -shared -o $*.pd_linux $*.o $(LIBS) rm -f *.o