For all issues regarding the Forums use, please, refer to the Forum Rules.

### Our Solutions

Need professional assistance?
Consider our:

Need to speed up your development?
Have a look at our:

Need some functionality extending standard OCCT capabilities?
Check out our:

# How to create a 3D solid from 3x 3D polyline ?

Forums:

#If I draw these 3 polyline, can I make a solid ?
# I tried the function thruesections and it faild because
#all polyline start at a common place !

polyline p1 0 0 0 1 1 1 2 1 1

polyline p2 0 0 0 1 -1 1 2 -1 1

polyline p3 0 0 0 1 0 0 2 0 0

how can I create a 3D solid with these three polyline ?

like:
DRAWEXE> ThisMisteriousFunction MySolid p1 p2 p3

Thank you very mutch.

No way I think. What concerning thrusections, actually it performs lofting through sections, that must be separate, non-touching each other. To create a solid in this particular way, you may need to create face by face, then make shell, then solid.

Thank you very mutch Bearloga for your hints.
Could you give me an example how to create face by face, then make shell, then solid, with my 3 polyline ?

Or a subset of polyline wish will result as the same 3D shape ?

Thank you very mutch

Here it is:

polyline w1 0 0 0 1 1 1 1 -1 1 0 0 0
polyline w2 0 0 0 1 0 0 1 1 1 0 0 0
polyline w3 0 0 0 1 0 0 1 -1 1 0 0 0
polyline w4 1 1 1 1 -1 1 2 -1 1 2 1 1 1 1 1
polyline w5 1 1 1 1 0 0 2 0 0 2 1 1 1 1 1
polyline w6 1 -1 1 1 0 0 2 0 0 2 -1 1 1 -1 1
polyline w7 2 0 0 2 1 1 2 -1 1 2 0 0
for {set i 1} {\$i mkplane f\$i w\$i
}
sewing sh f1 f2 f3 f4 f5 f6 f7
mksol so sh

Wonderfull !!! :-)
I tried to make a new test, I tryed to replace a normal wire plan by a circular plan... and now it don't seem to work! Is it an other procedure if I want to make a solide with two ellipse like:

ellipse e1 0 0 0 0 0 1 0 1 0 3 2
ellipse e2 1 1 2 0 0 1 1 0 1 2 1

how can I make a solide with these two ellipse ?

In this case you should use thrusections command. It accepts wire objects, while ellipse creates curve objects. To make wire from curve, use the commands mkedge and wire.

Wonderfull, it work :-)
Well, an other question. I try to make a solid whish look like half an apple from the revolution of a profile, and nothing seem to work. Could you tell me what is not correct ? I try to understand the documentation and, well, I think an update is needed for that topic. I don't understand what is skface ???

profile arkouzaki \
O 0 0 0 \
P 0 0 1 1 0 0 \
F 0 0 \
TT 4 5 \
C 2.245 220 \
W

plane skface 0 0 0 0 0 1

featrevol apple arkouzaki skface \
0 0 0 \
0 0 1 \
1 \
0

featperformval revol r 180

featrevol is not a tool that you need I think. Use simple revol:

profile pr O 0 0 0 P 0 0 1 1 0 0 F 0 0 TT 4 5 C 2.245 220 W
revol r pr 0 0 0 0.00256364551538368 6.34993291711337 0 180
# to make a solid we need to cover the planar hole
explode r e
wire w r_3 r_4 r_5 r_6 r_7
mkplane f w
sewing sh r f
mksol so sh

:-) I hope the documentation will be updated for this function becose it seem powerfull. ;-)
Thanks for the new approache, everything work now with my profile.

I have an other question... with the link between DRAWEXE and TCL.
I am new in OpenCascade, and in TCL also. I try to separate my working program file in multiple files. I want to use the function "proc" and "return", but I don't understand how to return a shape ? The only way that I found was to make a "global" declaraion of the shape name. This is my code:

=======>main.tcl source MyInclude.tcl
set UneBoule [boule 1 2 3]
donly UneBoule

=======>MyInclude.tcl proc boule {Xpos Ypos Zpos}
# Do I need to do a "dset" of the string in a numeric
# variable all the time ? Is it possible to skip this
# redondancy ? Because the "proc" function seem to accept
# only string ! Why ?
dset Xpos \$Xpos
dset Ypos \$Ypos
dset Zpos \$Zpos
sphere p [dval Xpos] [dval Ypos] [dval Zpos] 4
return p

#############################
If I do that, I see the sphere painted, and erased. ANd a letter "p" appear on the DRAWEXE terminal. I understand the problem is then in TCL, variable are local to the "proc". Well, when the proc is finished , everything disapear. I tryed with the command "upvar" without any success. The only way to see my sphere passing from the proc to the Main is when I define the sphere "p" as a "global" variable, in the "proc".... well, is it the only way that I can pass the shape from the proc to te main ? By doing this, the "return" commande is completly irrelevant. What is the best practice do to that ?

You don't need to use dset command to use numeric arguments. Use '\$' character to get the value where you need:
sphere p \$Xpos \$Ypos \$Zpos
But if you dset a variable, you can use it without dval in any OCC command:
sphere p Xpos Ypos Zpos

return in proc may return only strings. In your case it returns the string "p" that has nothing common with the local draw variable p.
Nevertheless you have several variants to return shape from proc, in addition to using global variable:
1. use upvar command:
upvar shape_in_main myshape
sphere myshape \$Xpos \$Ypos \$Zpos 4
2. use uplevel command:
uplevel sphere shape_in_main \$Xpos \$Ypos \$Zpos 4
3. set shape to the variable of upper scope by name got in command line:
proc boule {Xpos Ypos Zpos out_shape} {
upvar \$out_shape myshape
sphere myshape \$Xpos \$Ypos \$Zpos 4
}
boule 1 2 3 UneBoule
donly UneBoule
I prefer the last one because it allows to use various out shape names.

Wonderfull :-)
But I losted a very important thing: I lost the "pi" !!! Where is "pi" ? I tried to write
"global pi", but pi refuse to be full functional in the proc ! It is all the time equal to zero ! What can I do ? Do I need to put "pi" in the args of the proc ?

I did not found any problem with pi. It is a global draw variable that can be evaluated with dval. Any of the following works:

proc showpi {} {global pi; dval pi}
proc showpi {} {upvar pi pi; dval pi}
proc showpi {} {uplevel dval pi}