You can draw a sketch around the part and extrude cut, or use the Cavity command from Mold Tools, depending on your design.
My Design is that Snip I attached an image of.
but when I am in Assembly mode there is no Cavity command ,
You are highlighting the need for a cavity function that works with assemblies. This is sorely needed for situations such as you are describing. Please submit this as an Enhancement Request and post the number so we can also add our votes to it.
I could not find the Enhancement Request section.
One idea is to save your assembly as a part file so you can use tools like Indent (Insert > Features > Indent). Add the foam volume to interfere with your new part file, but make sure "Merge result" is cleared.
Property Manager: 2017 SOLIDWORKS Help - Indent PropertyManager
Then use the Delete Bodies command to get rid of the snips solid body so now this new part file is really representing your foam cavity.
You could do a multibody part building the box and foam around your parts.
Then save the bodies off and create an assembly.
If you want to do it in the assembly:
Create your assembly
Edit the foam part, draw a sketch around your part, then exit the edit part command.
It all depends if you want to go the master model route, or top down route through an assembly.
Thank you for your suggestions guys,
For some reason I could not get that Indent option work for my purpose.
this is how I did it:
1-created a drawing from part ( snip) and select the top view.
2- save the drawing as a Ai file.
3- make a solid flat object ( with combining the lines) give it an 3 mm outline and combine everything together to make one solid 2D image
4- open the solid 2D Ai file and Cut Extrude from the foam.