Jump to content
Developer Wiki and Function Reference Links ×

Flipping a group in 3D


Recommended Posts

I thought I had done this before, but apparently not.  So, say I create a group of 3D objects.  Some extrudes and some sweeps.  I close the group.  Now, I need to du0plicate it and flip it on the X axis.  I found that HScale3D(obj,0",0",0", -1,0,0) does not work like it does in 2D.  And Flip3DObj does not work on groups.  Is there any command I'm missing?  I'm hoping not to have to duplicate 130 lines of code and add flips to each piece.  It's the two headlights in this image.

 

image.png.662d309263b7dd79dd111e77be682628.png

Edited by SamIWas
Link to comment

Hello @SamIWas,

   I tested HScale3D(obj, 0, 0, 0,   -1, 0, 0), but it only accepts positive scale values.

 

   Use:  Flip3DObj(H, True);  for single 3D objects, where TRUE = Horizontal flip across Y-axis. For Groups of 3D objects, you will have to enter the group and flip each object individually.

 

Here's a sample that works on a very simple test group. Test it thoroughly before you use it on anything of value.

PROCEDURE xxx;
{ Example code: Duplicate a 3D object, or a 3D Group, and flip it across the Y-axis. }
{ 7 Jun 2024 - Raymond J Mullin }
{ THIS CODE IS LIGHTLY TESTED. USE ON A DUPLICATE FILE FIRST! }
VAR
	H, H1 :Handle;

	procedure FlipGroupX(H :Handle);
	{ Flip a group in the X-direction across the Y-axis. }
	Begin
		H := FInGroup(H);		{ H now points inside group }
		while (H<>nil) do begin
			Flip3DObj(H, True);
			H := NextObj(H);
		end;		{ while }
	End;		{ FlipGroupX }


BEGIN
	H := FSActLayer;
	H1 := HDuplicate(H, 0, 0);		{ make duplicate object }
	SetDSelect(H);				{ deselect original object }

	if (GetTypeN(H1) = 11) then FlipGroupX(H1)
	else Flip3DObj(H1, True);
	ResetBBox(H1);

	SysBeep;
END;
Run(xxx);

 

HTH,

Raymond

  • Like 1
Link to comment
  • 2 weeks 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...