Hi, is there a command to cut a solid by means of a polyline in order to obtain, see sketch, the red solid?
Support Forum
- Forum
- CAD Parametrische Modellierung
- CAD SmartParts
[Question] Solid cutting
Therefore exist the command CUTPOLY
Thank you Nemo for indication but maybe I explained myself badly. I meant to say that the external part of the prism with respect to the cutting polyline is eliminated (see new sketch).
Attachments (1)
So, if you not want the external box with ref_x,re_y,ref_z, then do not create it!
Create only the PRISM.
And if you want a intersection of PRISM and BOX then use GROUP_ISECT.
Create only the PRISM.
And if you want a intersection of PRISM and BOX then use GROUP_ISECT.
Thank you for indications of GROUP_ISECT...I try!
As you say, it would be easier to just do the internal PRISM but there is a reason why I want to do this procedure and it would be long to explain in this forum.
Create only the PRISM.
And if you want a intersection of PRISM and BOX then use GROUP_ISECT.
Hi Nemo, I tried but my code doesn't work...why?
Instead if I position the two groups without doing "isect" I see the two solids
3D CODE
ROTZ 180
FOR i = 1 TO p_cnt
id = id + 1
HANDLE2 0 , 0 , id , p [ i ][ x ], 1
HANDLE2 p [ i ][ x ], p [ i ][ y ], id , p [ i ][ x ], 2
HANDLE2 -1 , 0 , id , p [ i ][ x ], 3
HANDLE2 0 , 0 , id , p [ i ][ y ], 1
HANDLE2 p [ i ][ x ], id , p [ i ][ y ], id , 2
HANDLE2 0 , -1 , id , p [ i ][ y ], 3
x1 = p [ i ][ x ]y1 = p [ i ][ y ]IF i = p_cnt THEN
x2 = p [ 1 ][ x ]y2 = p [ 1 ][ y ]ELSE
x2 = p [ i + 1 ] [ x ]y2 = p [ i + 1 ] [ y ]ENDIF
cx = x1 + ( x2 - x1 ) / 2
cy = y1 + ( y2 - y1 ) / 2
id = id + 1
HANDLE2 cx , cy , id , "p_ins" , 10 , i
! PREV_ARC2 cx , cy , .01 , 0 , 360
IF p_cnt > 2 THEN
id = id + 1
HANDLE2 p [ i ][ x ], p [ i ][ y ], id , "p_del" , 10 , i
id = id + 1
ENDIF
PUT p [ i ][ x ], p [ i ][ y ]NEXT i
GROUP "pri"
PRISM p_cnt + 1 , REF_Z ,
GET ( NUM_SP )
GROUP_END
!GROUP_PLACE pri
ROTZ 180
GROUP "mat"
BOX REF_X , REF_Y , REF_Z
GROUP_END
!GROUP_PLACE mat
RESTORE 2
res = ""
res = GROUP_ISECT ( "pri" , "mat" )
GROUP_PLACE res
GOSUB "ins_hnd_p"
GOSUB "put_pnts_p"
!RESTORE 5
END
"ins_hnd_p":
FOR i = 1 TO p_cnt
x1 = p [ i ][ x ]y1 = p [ i ][ y ]IF i = p_cnt THEN
x2 = p [ 1 ][ x ]y2 = p [ 1 ][ y ]ELSE
x2 = p [ i + 1 ] [ x ]y2 = p [ i + 1 ] [ y ]ENDIF
cx = x1 + ( x2 - x1 ) / 2
cy = y1 + ( y2 - y1 ) / 2
IF no_prof = 0 THEN
HANDLE cx , cy , 0 , id , "p_ins" , 10 , i
ENDIF
id = id + 1
NEXT i
RETURN
"put_pnts_p":
FOR i = 1 TO p_cnt
cx = p [ i ][ x ]cy = p [ i ][ y ]IF no_prof = 0 THEN
HANDLE 0 , 0 , 0 , id , p [ i ][ x ], 1
HANDLE cx , cy , 0 , id , p [ i ][ x ], 2
HANDLE -1 , 0 , 0 , id , p [ i ][ x ], 3
HANDLE 0 , 0 , 0 , id , p [ i ][ y ], 1
HANDLE cx , cy , 0 , id , p [ i ][ y ], 2
HANDLE 0 , -1 , 0 , id , p [ i ][ y ], 3
id = id + 1
ENDIF
!!!delete handles only if more than 3 points
IF p_cnt > 3 THEN
IF no_prof = 0 THEN
HANDLE cx , cy , 0 , id , "p_del" , 10 , i
id = id + 1
ENDIF
ENDIF
PUT p [ i ][ x ], p [ i ][ y ], 0
! IF no_prof = 0 THEN
! LINE p [ i ][ x ], p [ i ][ y ], 0 , p [ i + 1 ] [ x ], p [ i + 1 ] [ y ], 0
! ENDIF
NEXT i
PUT p [ 1 ][ x ], p [ 1 ][ y ], 0
!IF no_prof = 0 THEN
! LINE p [ 4 ][ x ], p [ 4 ][ y ], 0 , p [ 1 ][ x ], p [ 1 ][ y ], 0
!ENDIF
RETURN
The first FOR-NEXT_Loop is wrong!
FOR i = 1 TO p_cnt
...
NEXT i
In addition PUT p [ 1 ][ x ], p [ 1 ][ y ], 0 is missing!
Should replaced with
GOSUB "put_pnts_p"
because this subroutine doing exactly this!
GOSUB "put_pnts_p" two lines before END do nothing meaningful!
I have the impression that YOU don't understand the code!
FOR i = 1 TO p_cnt
...
NEXT i
In addition PUT p [ 1 ][ x ], p [ 1 ][ y ], 0 is missing!
Should replaced with
GOSUB "put_pnts_p"
because this subroutine doing exactly this!
GOSUB "put_pnts_p" two lines before END do nothing meaningful!
I have the impression that YOU don't understand the code!
Yes, you are right.. do not understand the code. I tried but it's difficult for me.
FOR i = 1 TO p_cnt
...
NEXT i
In addition PUT p [ 1 ][ x ], p [ 1 ][ y ], 0 is missing!
Should replaced with
GOSUB "put_pnts_p"
because this subroutine doing exactly this!
GOSUB "put_pnts_p" two lines before END do nothing meaningful!
I have the impression that YOU don't understand the code!
Hi Nemo, I tried this code but Groupe_isect don't produces the expected result and I don't understand. Not even Group_diff produces the expected result.
3D CODE
ROTZ 180
GOSUB "put_pnts_p"
GOSUB "ins_hnd_p"
GROUP "pri"
PRISM p_cnt + 1 , REF_Z ,
GET ( NUM_SP )
GROUP_END
!GROUP_PLACE pri
RESTORE 1
GROUP "mat"
BOX REF_X , REF_Y , REF_Z
GROUP_END
!GROUP_PLACE mat
res = ""
res = GROUP_ISECT ( "pri" , "mat" )
GROUP_PLACE res
END
"ins_hnd_p":
FOR i = 1 TO p_cnt
x1 = p [ i ][ x ]y1 = p [ i ][ y ]IF i = p_cnt THEN
x2 = p [ 1 ][ x ]y2 = p [ 1 ][ y ]ELSE
x2 = p [ i + 1 ] [ x ]y2 = p [ i + 1 ] [ y ]ENDIF
cx = x1 + ( x2 - x1 ) / 2
cy = y1 + ( y2 - y1 ) / 2
IF no_prof = 0 THEN
HANDLE cx , cy , 0 , id , "p_ins" , 10 , i
ENDIF
id = id + 1
NEXT i
RETURN
"put_pnts_p":
FOR i = 1 TO p_cnt
cx = p [ i ][ x ]cy = p [ i ][ y ]!!!delete handles only if more than 3 points
IF p_cnt > 3 THEN
HANDLE2 0 , 0 , id , p [ i ][ x ], 1
HANDLE2 cx , cy , id , p [ i ][ x ], 2
HANDLE2 -1 , 0 , id , p [ i ][ x ], 3
HANDLE2 0 , 0 , id , p [ i ][ y ], 1
HANDLE2 cx , cy , id , p [ i ][ y ], 2
HANDLE2 0 , -1 , id , p [ i ][ y ], 3
id = id + 1
HANDLE2 cx , cy , id , "p_del" , 10 , i
id = id + 1
ENDIF
PUT p [ i ][ x ], p [ i ][ y ]NEXT i
RETURN