Cut out area within tube

Hi,

I have a tube which is directly connected to a certain body. The body is wrapped with a material of about 100µm.
Now I need to remove this wrapping within the tube. How do I do that?
The region where the tube connects the body is already cut out via a boolean composition. But only for the thickness of the tube. But the area within the tube has also to vanish.

Via a boolean composition I will always remain something of this wrapping, ain’t? I need something like a infinitesimal circle within this tube to remove the wrapping properly. I guess this is not doable, or?
Are there are better remedies?

Thank you in advance!

Hi,

does it have anything to do with ROOT?

I guess: https://root.cern.ch/doc/master/classTGeometry.html

Hi,

Not sure I fully get the picture, but I will try to help. You should first remove from the body+wrapping a cylinder (rmin=0 and same rmax of your tube). Then you can position int this hole your tube.

Best,

Hi agheata,

thanks your idea! This came also up to my mind so by having two heads with the same idea I will do this then :slight_smile:
Thank you!

Hey,

guess this is a nerverending story… sorry, didn’t do anything with TGeo before so probably I’ll transform this thread to my personal learning thread…

I tried to implement the described idea above but something is not working and I don’t know why. I receive the following:

and I don’t understand the difference. Both are the same but the one is looked at via OpenGL.
There should be hole at the side and the body itself should be empty. The latter it is obviously but there is no hole (?). I tried some different kinds of composition but it stays the same.
Can someone please figure out what’s going on? Thanks a lot in advance!

The code:

void cap_simulation()
{
// gStyle->SetCanvasPreferGL(true);
	gSystem->Load("libGeom");

// Materials remain to be defined exactly !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	TCanvas *c = new TCanvas("composite shape", "", 700, 1000);
	if (gGeoManager) delete gGeoManager;
	TGeoManager *geom = new TGeoManager("cap", "cap geometry");

//--- define some materials  
	TGeoMaterial *matVACUUM = new TGeoMaterial("VACUUM", 0,0,0);	
	TGeoMaterial *matPOLYAMID = new TGeoMaterial("polyamid-12", 197.3,110,1.06);			
	TGeoMaterial *matPWO = new TGeoMaterial("PWO", 10,10,1);
	TGeoMaterial *matVM2000 = new TGeoMaterial("VM2000", 10,10,1);

//--- define some media
	TGeoMedium *VACUUM = new TGeoMedium("VACUUM",1, matVACUUM);
	TGeoMedium *POLYAMID = new TGeoMedium("Polyamid",2, matPOLYAMID);
	TGeoMedium *PWO = new TGeoMedium("PWO",3, matPWO);
	TGeoMedium *VM = new TGeoMedium("VM",4, matVM2000);

//--- make World
	TGeoVolume *World = geom->MakeBox("World", VACUUM, 300., 300., 50.);
	gGeoManager->SetTopVolume(World);
	World->SetVisibility(kFALSE);

//--- define the transformations
// no translation
	TGeoTranslation *tr1 = new TGeoTranslation(0., 0., 0.);

// turn drilling
	TGeoRotation *rot1 = new TGeoRotation("rot1", 60., 90., 90.);

// turn and move drilling
	TGeoCombiTrans *combi1 = new TGeoCombiTrans(-5.,3.,0., rot1);
	combi1->SetName("combi1");

// make body_1 perpendicular
	TGeoRotation *rot2 = new TGeoRotation("rot2", 90., 90., 0.);

// move Body
	TGeoCombiTrans *combi2 = new TGeoCombiTrans(4.5,0.,0., rot2);
	combi2->SetName("combi2");

	TGeoCombiTrans *combi3 = new TGeoCombiTrans(11.,0.,0., rot2);
	combi3->SetName("combi3");

	TGeoCombiTrans *combi4 = new TGeoCombiTrans(15.,0.,0., rot2);
	combi4->SetName("combi4");

//turn and move crystal	
	TGeoCombiTrans *combi5 = new TGeoCombiTrans(117.,0.,0., rot2);				
	combi5->SetName("combi5");

//turn and move hole/space for the foil		
	TGeoCombiTrans *combi6 = new TGeoCombiTrans(17.08175,0.,0., rot2);				
	combi6->SetName("combi6");

// register
	combi1->RegisterYourself();
	combi2->RegisterYourself();
	combi3->RegisterYourself();
	combi4->RegisterYourself();
	combi5->RegisterYourself();
	combi6->RegisterYourself();

// Ceeate Sphere of the cap
	TGeoVolume *Sphere_V = geom->MakeSphere("Sphere", POLYAMID, 5., 7., 0., 180., 90., -90.);
	Sphere_V->SetLineColor(kRed);
	TGeoSphere *Sphere = (TGeoSphere*)Sphere_V->GetShape();

// Create Drilling for the Cap
	//				    (name, medium, rmin, rmax, dz, phi_start, phi_end)
	TGeoVolume *Tube_V = geom->MakeTubs("Tube", VACUUM, 0., 1., 1.2, -180., 180.);	
	Tube_V->SetLineColor(kBlue);
	TGeoSphere *Tube = (TGeoSphere*)Tube_V->GetShape();

// Create opening for the wrapping
	//				    (name, medium, rmin, rmax, dz, phi_start, phi_end)
	TGeoVolume *Tube_Volume = geom->MakeTubs("Tube_Vw", VACUUM, 0., 5.5, 0.08175, -180., 180.);	
	Tube_Volume->SetLineColor(kGreen);
	TGeoSphere *Tube_Vw = (TGeoSphere*)Tube_Volume->GetShape();

// Create Cap
	TGeoVolume *Body_1 = geom->MakeTube("Body_1", POLYAMID, 5., 7., 4.5);	
	Body_1->SetLineColor(kRed);

	TGeoVolume *Body_2 = geom->MakeTube("Body_2", POLYAMID, 5., 8., 2.);	
	Body_2->SetLineColor(kBlue);

	TGeoVolume *Body_3 = geom->MakeTube("Body_3", POLYAMID, 5., 5.5, 2.);	
	Body_3->SetLineColor(kRed);

// Create Crystal
	TGeoVolume *Crystal_V = geom->MakeArb8("Crystal", PWO, 100.08175);
	Crystal_V->SetLineColor(kBlue);
	TGeoArb8 *arb = (TGeoArb8*)Crystal_V->GetShape();

	// lower xy-plane
	arb->SetVertex(0,-10.89,-10.64);
	arb->SetVertex(1,-10.89,10.64);
	arb->SetVertex(2,10.89,10.64);
	arb->SetVertex(3,10.89,-10.64);
	// upper xy-plane
	arb->SetVertex(4,-10.89,-10.64);
	arb->SetVertex(5,-10.89,10.64);
	arb->SetVertex(6,10.89,10.64);
	arb->SetVertex(7,10.89,-10.64);

// Create foil outer edges
	TGeoVolume *Foil_out_V = geom->MakeArb8("Foil_out", VM, 100.08175);
	Foil_out_V->SetLineColor(kBlue);
	TGeoArb8 *arb2 = (TGeoArb8*)Foil_out_V->GetShape();

	Double_t outer_foil = 0.08175;
	// lower xy-plane
	arb2->SetVertex(0,-10.89-outer_foil,-10.64-outer_foil);
	arb2->SetVertex(1,-10.89-outer_foil,10.64+outer_foil);
	arb2->SetVertex(2,10.89+outer_foil,10.64+outer_foil);
	arb2->SetVertex(3,10.89+outer_foil,-10.64-outer_foil);
	// upper xy-plane
	arb2->SetVertex(4,-10.89-outer_foil,-10.64-outer_foil);
	arb2->SetVertex(5,-10.89-outer_foil,10.64+outer_foil);
	arb2->SetVertex(6,10.89+outer_foil,10.64+outer_foil);
	arb2->SetVertex(7,10.89+outer_foil,-10.64-outer_foil);

// Create foil inner edges
	// 100µm / 2 =  0.05mm / 2 = 0.05mm

	TGeoVolume *Foil_in_V = geom->MakeArb8("Foil_in", VM, 100.05);
	Foil_in_V->SetLineColor(kRed);
	TGeoArb8 *arb3 = (TGeoArb8*)Foil_in_V->GetShape();

	Double_t inner_foil = 0.05;
	// lower xy-plane
	arb3->SetVertex(0,-10.89-inner_foil,-10.64-inner_foil);
	arb3->SetVertex(1,-10.89-inner_foil,10.64+inner_foil);
	arb3->SetVertex(2,10.89+inner_foil,10.64+inner_foil);
	arb3->SetVertex(3,10.89+inner_foil,-10.64-inner_foil);
	// upper xy-plane
	arb3->SetVertex(4,-10.89-inner_foil,-10.64-inner_foil);
	arb3->SetVertex(5,-10.89-inner_foil,10.64+inner_foil);
	arb3->SetVertex(6,10.89+inner_foil,10.64+inner_foil);
	arb3->SetVertex(7,10.89+inner_foil,-10.64-inner_foil);

// Add nodes to the world
	//World->AddNode(Body_1, 1, combi2);
	//World->AddNode(Body_2, 2, combi3);
	//World->AddNode(Body_3, 3, combi4);
	//World->AddNode(Crystal_V, 4, combi5);
	//World->AddNode(Tube_Volume, 4, combi6);

// make drilling into the sphere of the cap
	// Union:
	TGeoSubtraction("Sphere","Tube");
	TGeoCompositeShape * cs1 = new TGeoCompositeShape("drilling","(Sphere)-(Tube:combi1)");
	TGeoVolume *comp1 = new TGeoVolume("COMP1",cs1);
	comp1->SetMedium(POLYAMID);
	comp1->SetLineColor(kBlue);

	TGeoSubtraction("foil","Tube_Vw");
	TGeoCompositeShape * cs3 = new TGeoCompositeShape("cap_hole","((Foil_out:combi5)-(Foil_in:combi5))-(Tube_Vw:combi6)");
	TGeoVolume *comp3 = new TGeoVolume("COMP3",cs3);
	comp3->SetMedium(POLYAMID);
	comp3->SetLineColor(kGreen);


// Add new composite node to the world
	//World->AddNode(comp1, 1);
	//World->AddNode(wrapping, 2);
	World->AddNode(comp3, 3);

//--- close the geometry
	geom->CloseGeometry();
	gGeoManager->SetNsegments(50);

//--- Make the geometries visible
	geom->SetVisLevel(4);
	World->Draw("ogle");
//	World->Draw("");

}

Solved it.

One object had to be moved a little more than I did actually…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.