This snippet allows you to draw 2D lines which represent extrusions of a vertically segmented column.
The program will then render the actual (symmetrical) 3D column from your 2D layout.
NOTE: To get a clean object with this early version it's advised to add lines from TOP to BOTTOM only.
However, starting a line where the previous one was seems to look alright.+ Code SnippetDummy=900:make object cylinder Dummy,1:hide object Dummy
Orange = rgb(200,100,0)
White=rgb(180,200,180)
Green=rgb(0,200,0)
HalfW=screen width()/2
HalfH=screen height()/2
backdrop on:color backdrop rgb(42,62,35)
dim x(10000) `dim x(10000)
dim y(10000) `dim y(10000)
x(1)=screen width()*.4:y(1)=screen height()*.15
Selected=1
ReStart:
if Main>0 then delete object Main
do
if mousex()>=HalfW then position mouse HalfW,mousey()
gosub 2dRender
if EditMode=1 then if returnkey() or mouseclick()=1 then goto ModeJump
if EditMode=0 and lower$(inkey$())="a" then inc AddMode:if AddMode=1 then inc Linecount:Selected=LineCount:x(Selected)=mousex():y(Selected)=mouseY():EditMode=1
if AddMode=2
AddMode=0
x(Selected)=mousex():y(Selected)=mouseY()
ENDIF
if lower$(inkey$())="d" then x(Selected)=0:y(Selected)=0:Selected=LineCount-1
if lower$(inkey$())="r" then goto 3dRender
if lower$(inkey$())="e" and AddMode=0 then inc EditMode:position mouse x(Selected),y(Selected)
if EditMode=2
ModeJump:
EditMode=0:AddMode=0
x(Selected)=mousex():y(Selected)=mouseY()
ENDIF
while inkey$()<>""
gosub 2DRender
ENDWHILE
if scancode()=15 then inc Selected:if Selected>LineCount then Selected=1
while scancode()=15: Gosub 2dRender:ENDWHILE
LOOP
`RENDER in 3D
3dRender:
Main=9000
make mesh from object Dummy,Dummy
make object plain Main,0,0
for L=1 to (LineCount-1)
add limb Main,L,Dummy
lock vertexdata for limb Main,L
for v=0 to get vertexdata vertex count()
xx#=get vertexdata position x(v)
yy#=get vertexdata position y(v)
zz#=get vertexdata position z(v)
position object Dummy,0,yy#,0
point object Dummy,xx#,yy#,zz#
if yy#>0
xFinal#=HalfW-x(L)
move object Dummy,abs(xFinal#*1)
xx#=object position x(Dummy):zz#=object position z(Dummy)
set vertexdata position v,xx#,(-y(L)*1)+HalfH,zz#
ENDIF
if yy#<0
xFinal#=HalfW-x(L+1)
move object Dummy,abs(xFinal#*1)
xx#=object position x(Dummy):zz#=object position z(Dummy)
set vertexdata position v,xx#,(-y(L+1)*1)+HalfH,zz#
ENDIF
next
unlock vertexdata
NEXT
scale object Main,10,10,10
make mesh from object Main,Main
delete object Main
Make object Main,Main,0
set object cull Main,0
do
if lower$(inkey$())="q" then goto ReStart
if inkey$()="s"
f$="aaa_NewColumn.dbo"
if file exist(f$) then delete file f$
save object f$,Main:end
ENDIF
control camera using arrowkeys 0,.1,.1
set cursor 0,0
print "[Q]=Return to Editor"
print
print "[S]=Save as 'aaa_NewColumn.dbo'"
LOOP
2dRender:
LineCount=0
for n=1 to 1000
if Selected=n then ink Orange,0 else ink White,0
if Selected=n and EditMode=1 then ink Green,0
if x(n)<>0 then LineCount=n
if x(n)<>0 and EditMode=0 then line x(n),y(n),(HalfW)+(HalfW-x(n)),y(n)
if n<>Selected and EditMode=1 then line x(n),y(n),(HalfW)+(HalfW-x(n)),y(n)
if n=Selected and EditMode=1 then line mousex(),mousey(),(HalfW)+(HalfW-mousex()),mousey():LineCount=n
next
if EditMode=1 then ink green,0 else ink White,0
set cursor 0,0:print "[TAB] Selected: ";Selected;"/";LineCount
print
print "[E]dit Selected Line"
print
print "[A]dd a Line"
print
print "[D]elete Selected Line"
print
print "[R]ender Column"
print
set cursor 0,400:print mousex();",";mousey()
return
Feel free to revamp this code into something better!