Jump to content
Developer Wiki and Function Reference Links ×

Recommended Posts

Hi,

 

A lot of times when working in 3D I want to use the Working Plane but my view got blocked by objects in front of the plane. The Clip Cube can help with that. But it takes a lot of time to setup. That's why I decided to make a script that sets the Clip Cube based on the active Working Plane. Since there are no functions available to set the position of the Clip Cube I used a trick to make a huge extrusion on the workplane and use that to set the boundaries of the Clip Cube. This works for most user-cases but unfortunately not for rotated Working Planes. @Marissa Farrellcan you throw in an enhancement request for more control of the Clip Cube with Vectorscript?

 

 

Step 1: Set Working Plane

1478473556_Stap1.thumb.JPG.4a50097d17b450fb71a6d916f6884919.JPG

 

Step 2: Look at Working Plane, view gets blocked

1980835030_Stap2.JPG.7cb5db0fa47d0e7436980b8dfd713532.JPG

 

 

Step 3: Run Script, view gets unblocked

489918769_Stap3.JPG.c7f135217490229cb08a272b7997a527.JPG

 

PROCEDURE ClipCubeByPlane;
{Sets the Clip Cube position equal to the Working Plane.}
{Since we cannot rotate the Clip Cube by script this work best with Working Planes on X and Y.}

{© 24-06-2022 Arnhem - The Netherlands, Marcel Plomp}

{Licensed under the GNU Lesser General Public License}
VAR
	H1							:Handle;
	xRot, yRot, zRot 			:REAL;
	p0X, p0Y, p0Z 				:REAL;



BEGIN
		{Turn off Clip Cube}
		SetPref(6707, FALSE);
		DSelectAll;
		
		{Create big extrusion}
		BeginXtrd(0,-1000000);
			rect(-1000000, 1000000, 1000000,-1000000); 
		EndXtrd; 
		
		{Get workplane coordinates}
		GetWorkingPlane(p0X, p0Y, p0Z, xRot, yRot, zRot);		
			
		{Move object to workplane}	
		H1:=LNewObj;
		SET3DRot(H1, xRot, yRot, 0 , 0,0,0);
		Move3DObj(H1, p0X, p0Y, p0Z);	
		
		{Enable Clip Cube and delete object}
		SetPref(6707, TRUE);
		DelObject(H1);

END;
RUN(ClipCubeByPlane);

 

  • Like 2
Link to comment

This would be very useful! Or somehow to make a Clip Cube automatically align/rotate to a selected object on creation (I am forever activating the Clip Cube, rotating it to align with the model then creating a Saved View).

 

As a secondary point, @MarcelP102 you are making scripting look really easy it is very inspiring well done!

  • Like 1
Link to comment
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...