Jump to content

How to remove parts from a .craft file?


Recommended Posts

I have a .craft file of a complete space station that I built in the VAB. I use this file when I am launching pieces of it for assembly. A little while back, I updated KAS and now outdated parts from that mod are keeping me from using that file. I'd like to know how to remove those parts from the .craft file.

Link to comment
Share on other sites

.craft files should be pretty easy to edit in any text editor.

If nothing is attached to the part, just delete the entire PART section for that part. (That is, the part was placed on something, but nothing was placed on the part you want to remove.

Edit: Then delete the name of that part (partName_number) from the PART section of the part it was attached to.

If something is attached to the part, it gets trickier. In a PART section there are a few variables that describe how the part is connected to the other parts of the vessel.

I suggest you go to the VAB and make a very simple rocket: 1 pod, one fuel tank, one engine,

and slap one solar panel on the side of the fuel tank. Then go to the VAB and make a second very simple rocket: the same pod and engine, without the tank and panel. Now you can compare the two to see what is needed to remove a part.

In the PART section for the pod, it will contain a link to the tank.

In the PART section for the tank section, a link to the pod, a link to the engine and a link to the panel.

In the PART section for the engine, a link to the tank.

So to get rid of the tank and panel, replace the engine's link to the tank with the tank's link to the pod,

and the pod's link to the tank with the tank's link to the engine. Then delete the tank and panel PART sections.

Then you may have to edit the position of the part in the "pos" variable. It seems the second coordinate is the z coordinate, which is the distance from the floor of the VAB, or something similar. The z coordinate of all parts attached to moved parts should be adjusted by the same amount (which should be the height of the removed part.)

If the part you care about was attached with symmetry, attach the solar panels above with symmetry to see how symmetric parts are linked in .craft files.

Edited by Yasmy
Link to comment
Share on other sites

Even if nothing is attached to that part, you cannot simply delete that part from the .craft file. Except if it is the last part in the ship. Otherwise you screw up the structure of the ship.

The best thing you can do is replace those parts in place by other parts (e.g. cubic octagonal struts), load the file and remove them in editor.

Link to comment
Share on other sites

Even if nothing is attached to that part, you cannot simply delete that part from the .craft file. Except if it is the last part in the ship. Otherwise you screw up the structure of the ship.

The best thing you can do is replace those parts in place by other parts (e.g. cubic octagonal struts), load the file and remove them in editor.

.craft files are different from save files. The order of the parts in the .craft file doesn't matter. Each part is linked explicitly to other parts by a unique part id,

rather than by the order of the part in a vessel like in a .sfs file. Thus you do not have to renumber all the parts and links in and to parts after the removed part.

You just have to remove the part, and references to it from other parts if nothing is attached to it. (So yes, you do have to do slightly more than remove the part.)

But yes, sometimes it is easier to edit the part to be a different part. You still have to edit the links in the new part and the part it is attached to.

Edited by Yasmy
Link to comment
Share on other sites

Here are three craft files, with some unimportant stuff removed:

A: pod, tank, engine, and a modded part, KER, slapped on the side of the tank

B: pod, tank, engine. no KER

C: pod, engine. (example of removing a part in the middle of the part tree.)

Between craft files A and B, the only differences are

1) the lack of the Engineer part

2) the lack of the link to the Engineer part in the tank part in craft B: link = Engineer7500_4294809086

Between craft files B and C, the only differences are

1) the lack of the fuel tank in C

2) in C, the pod link goes to the engine, and the engine link goes to the pod

3) the position of the engine has changed by the height of the tank

ship = A
*deleted stuff for brevity*
PART
{
part = mk1pod_4294824866
partName = Part
pos = 0,5,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
link = fuelTank_4294819070
attN = bottom,fuelTank_4294819070
*deleted stuff for brevity*
}
PART
{
part = fuelTank_4294819070
partName = Part
pos = 0,3.629272,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
link = liquidEngine3_4294816122
link = Engineer7500_4294809086
attN = top,mk1pod_4294824866
attN = bottom,liquidEngine3_4294816122
*deleted stuff for brevity*
}
PART
{
part = liquidEngine3_4294816122
partName = Part
pos = 0,2.44615,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
attN = top,fuelTank_4294819070
*deleted stuff for brevity*
}
PART
{
part = Engineer7500_4294809086
partName = Part
pos = -5.412827E-08,3.856584,-0.6191552
rot = 0,0.7071068,0,-0.7071069
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 1
srfN = srfAttach,fuelTank_4294819070
*deleted stuff for brevity*
}

ship = B
*deleted stuff for brevity*
PART
{
part = mk1pod_4294824866
partName = Part
pos = 0,5,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
link = fuelTank_4294819070
attN = bottom,fuelTank_4294819070
*deleted stuff for brevity*
}
PART
{
part = fuelTank_4294819070
partName = Part
pos = 0,3.629272,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
link = liquidEngine3_4294816122
attN = top,mk1pod_4294824866
attN = bottom,liquidEngine3_4294816122
*deleted stuff for brevity*
}
PART
{
part = liquidEngine3_4294816122
partName = Part
pos = 0,2.44615,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
attN = top,fuelTank_4294819070
*deleted stuff for brevity*
}

ship = C
*deleted stuff for brevity*
PART
{
part = mk1pod_4294824866
partName = Part
pos = 0,5,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
link = liquidEngine3_4294816122
attN = bottom,liquidEngine3_4294816122
*deleted stuff for brevity*
}
PART
{
part = liquidEngine3_4294816122
partName = Part
pos = 0,4.32434,0
rot = 0,0,0,1
attRot = 0,0,0,1
mir = 1,1,1
istg = 0
dstg = 0
sidx = -1
sqor = -1
attm = 0
attN = top,mk1pod_4294824866
*deleted stuff for brevity*
}

Note how each part has a unique id number attached to the part name. If you add more parts of the same type, the id numbers will be different. Position of the part in the craft file doesn't matter (except maybe the root part.) So removing a part only effects the parts which link to it by name. Of course, if you remove a part in the middle of a structure, and attach the parts it connected to to each other, you will leave a gap. Thus you need to adjust the pos variable of any parts that need to be moved to fill the gap. If you can fill the gap with a similar sized part (by making the appropriate links), you won't have to adjust the positions of anything.

Edited by Yasmy
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.   Paste as plain text instead

  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...