Sometimes converting models from fbx to usdc results in empty models, when trying to open in native preview (xcode on Mac). But in Web preview on aspose.com model is completely fine. Also model is normal in Blender. There are initial fbx and resulting usdc models in archive.
models.zip (6.0 KB)
Can you please also share the sample code snippet that you are using? We will test the scenario in our environment and address it accordingly.
public class ConversionResult
{
public ConversionResult()
{
UnSucceesedConverted = new List<string>();
SucceesedConverted = new List<string>();
}
public List<string> UnSucceesedConverted { get; set; }
public List<string> SucceesedConverted { get; set; }
}
public class FileDto
{
public string FileName { get; set; }
public Stream File { get; set; }
}
public class ModelTask
{
[JsonPropertyName("modelInformations")]
public List<ModelInformation> ModelInformations { get; set; }
}
public class ModelInformation
{
[JsonPropertyName("model")]
public string PathToModel { get; set; }
[JsonPropertyName("formats")]
public IList<ModelInformationFormat> FormatsToConvert { get; set; }
[JsonPropertyName("textures")]
public IList<string> Textures { get; set; }
[JsonPropertyName("transform")]
public ModelInformationTransform Transform { get; set; }
}
public class ModelInformationTransform
{
[JsonPropertyName("scale")]
public ModelInformationVec3 Scale { get; set; }
[JsonPropertyName("position")]
public ModelInformationVec3 Position { get; set; }
[JsonPropertyName("rotation")]
public ModelInformationVec3 Rotation { get; set; }
}
public class ModelInformationVec3
{
[JsonPropertyName("x")]
public double X { get; set; }
[JsonPropertyName("y")]
public double Y { get; set; }
[JsonPropertyName("z")]
public double Z { get; set; }
}
public class ModelInformationFormat
{
[JsonPropertyName("fileName")]
public string FileName { get; set; }
[JsonPropertyName("formatName")]
public string FormatName { get; set; }
}
public ConversionResult UploadModelForCurrentFormats(FileDto model, string path, ModelInformation modelInf)
{
ModelInformationVec3 scale = modelInf.Transform.Scale;
ModelInformationVec3 position = modelInf.Transform.Position;
ModelInformationVec3 rotation = modelInf.Transform.Rotation;
ConversionResult result = new ConversionResult();
Scene scene = new Scene();
var modelExtension = Path.GetExtension(model.FileName);
if (!_allExtensions.Any(ext => ext.Value.CanImport && ext.Value.Extensions.Any(e=>e.Equals(modelExtension))))
throw new Exception($"The file format {modelExtension} is not supported by the converter");
scene.Open(model.File);
scene.RootNode.Transform.Scale = new Vector3(scale.X, scale.Y, scale.Z);
scene.RootNode.Transform.Translation = new Vector3(position.X, position.Y, position.Z);
scene.RootNode.Transform.PostRotation = new Vector3(rotation.X, rotation.Y, rotation.Z);
foreach (var format in modelInf.FormatsToConvert)
{
try
{
var extFormat = Path.GetExtension(format.FileName);
if (!_allExtensions.ContainsKey(format.FormatName))
throw new Exception($"{format.FormatName} is not supported by the Aspose converter");
var asposeFormat = _allExtensions[format.FormatName];
if (!asposeFormat.CanExport)
throw new Exception($"Export to {format.FormatName} is not supported by the Aspose converter");
if (!asposeFormat.Extensions.Any(e=>e.Equals(extFormat)))
throw new Exception($"Extension {extFormat} not found for format {format.FormatName} in Aspose converter");
scene.Save(Path.Combine(path, format.FileName), asposeFormat);
result.SucceesedConverted.Add(format.FormatName);
}
catch (Exception ex)
{
result.UnSucceesedConverted.Add($"{format.FormatName}: {ex.Message}");
continue;
}
}
return result;
}
We have logged an issue as THREEDNET-962 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.
We are sorry for the inconvenience.