Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / Instances and Node Attribute / Family and materials from revit
  RSS 2.0 ATOM  

Instances and Node Attribute / Family and materials from revit
Rate this thread
 
49796
 
Permlink of this thread  
avatar
  • Total Posts: 4
  • Joined: 24 November 2010 06:15 AM

Hello,

I’m currently using the FBX SDK for import/export in a Software, and I’m having two issues. I joined my questions, but I can make two different post if you want.

The first one is caused by instance in a FBX file. I’m parsing recursively each nodes, but when a bones match an instantiated mesh the function GetNodeAttribute() always return NULL. I tried my file with the Scene Tree View Sample, and everything work as intended, the nodes have an attribute, eMESH, and everything is show. I’m trying to find out why my nodes are empty, but for now I still didn’t get it. Maybe you’ll have a clue ? Is there any special initialization, or parameter to set in order to view instance ?

I was using FBX SDK 2010.2, I update it to 2011.3.1 when I noticed this issue, but the result was the same on older versions.

Here is some examples of my code:

private : CModelBone ProcessNode(Matrix pParentAbsoluteTransform,
   
CModelBone pPotentialParent,
   
KFbxNode pFbxNode)
 
{

 CModelBone 
aNode this->ProcessInformationInNode(pFbxNode,
 
pPotentialParent,
 
aNameForFbxObject);
 
 if (
aNode == nullptr)
 
{
   
return nullptr;
 
}

 int aNum 
0;
 if( 
pFbxNode->GetChildCount(false))
 
{
 
do
 
{
 KFbxNode 
aNodePtr pFbxNode->GetChild(aNum);
 
CModelBone aItem this->ProcessNode(aResult->get_AbsoluteTransform(), 
 
aNode,
 
aNodePtr);

 
aNum++;
 
}
 
while (aNum pFbxNode->GetChildCount(false));
 
}

 
return aNode;
 
}
 
 
 
private: CModelBone ProcessInformationInNode(KFbxNode pFbxNode,
  
CModelBone pParent,
  
String pName)
     
{
 CModelBone 
aContent nullptr;

 if (
pFbxNode->GetNodeAttribute() == NULL)
 
{
 
return gcnew CModelBone(m_GraphicEngine,Nullable<unsigned int>(),pParent);
 
}

 KFbxNodeAttribute
aNodeAttribute pFbxNode->GetNodeAttribute();
     switch (
aNodeAttribute->GetAttributeType())
     
{
 
case KFbxNodeAttribute::eCAMERA:
 return 
CreateCamera(pFbxNodepParent);
 break;
 case 
KFbxNodeAttribute::eNURBS_CURVE:
 return 
aContent;
 break;
 case 
KFbxNodeAttribute::eNULL:
 return 
gcnew CModelBone(m_GraphicEngine,Nullable<unsigned int>(),pParent);
 break;
 case 
KFbxNodeAttribute::eMESH:
 
 return 
this->m_MeshConverter->FillNodeWithInfoFromMesh(pFbxNode,
 
pName,
 
this->m_pFBXGeometryConverter);
 break;

 default:
 
{
 
return aContent;
 
}
   }
   
return nullptr;
 
}

pFbxNode->GetNodeAttribute() is always null when the mesh is an instance. I’ll join my test file as an attachment. It was made with the cube creator sample, modified to create new cubes as instance.

My second issue happen when importing FBX files from revit, with family. For example, for a wall with windows, each window will be a single object, without material, and without distinctions between wood and glasses for example. Whereas other materials works fine when coming from other software, even multi materials from 3DSMAX. You’ll find a FBX File from Revit attached to this post.
Is there anything special to do for Revit’s files ? How can I get materials informations from Revit ?

Thanks for any help, and sorry for my poor english.



Attachment Attachment
Replies: 0
avatar

I just “resolved” my first issue.

The bone wasn’t empty from the beginning but was destroyed because of mesh processing. I was using the function TriangulateInPlace()

pGeometryConverter->TriangulateInPlace(pFbxNode);

I comment it and every nodes had their correct attributes.
Is it a known issue of this function or did I mess up somewhere ?



Replies: 0
avatar

Hello, Alex,
I cannot reproduce your first problem by cube_instance.fbx
Here are my test code according to your description, do the triangulate first, and then try to get node attribute on all three cubes, two of them are instances, you may call this function from ImportScene Sample on cube_instance.fbx, all three node attributes are intact :

void TestTriangulatedInstance(KFbxScenepScene)
{
 KFbxNode
lNode01 pScene->GetRootNode()->FindChild("Cube number 1");
 
KFbxNodelNode02 pScene->GetRootNode()->FindChild("Cube number 2");
 
KFbxNodelNode03 pScene->GetRootNode()->FindChild("Cube number 3");


 
KFbxMeshlMesh01 = (KFbxMesh*) lNode01->GetNodeAttribute();
 if(
lMesh01)
 
{
 KFbxGeometryConverter
(lMesh01->GetFbxSdkManager()).TriangulateMesh(lMesh01);
 
}

 KFbxMesh
lMesh02 = (KFbxMesh*) lNode02->GetNodeAttribute();
 if(
lMesh02)
 
{
 KFbxGeometryConverter
(lMesh02->GetFbxSdkManager()).TriangulateMesh(lMesh02);
 
}

 KFbxMesh
lMesh03 = (KFbxMesh*) lNode03->GetNodeAttribute();
 if(
lMesh03)
 
{
 KFbxGeometryConverter
(lMesh03->GetFbxSdkManager()).TriangulateMesh(lMesh03);
 
}

 KFbxNodeAttribute
lNodeAttribute01 lNode01->GetNodeAttribute();
 if(
lNodeAttribute01)
 
{
 DisplayString
("Node Name: ", (char *) lNode01->GetName());
 
}

 KFbxNodeAttribute
lNodeAttribute02 lNode02->GetNodeAttribute();
 if(
lNodeAttribute02)
 
{
 DisplayString
("Node Name: ", (char *) lNode02->GetName());
 
}

 KFbxNodeAttribute
lNodeAttribute03 lNode03->GetNodeAttribute();
 if(
lNodeAttribute03)
 
{
 DisplayString
("Node Name: ", (char *) lNode03->GetName());
 
}
}

For the second question, if the mateials in the Revit file are something called “Autodesk Material”, “Consistent Material” or “Protein Material”, then they can not be handled by FBX sdk, for more detailes please refet to this link:
http://area.autodesk.com/for...iles-exported-from-revit/



Jiayang Xu
Maya Data Platform
Autodesk

Replies: 0
avatar

Thanks for your answer !

My problem was that I was using TriangulateInPlace() in my mesh operations, instead of TriangulateMesh(). With the first one the next bones where empty, but now it’s good.

For the Revit’s FBX, yes, the material are “Autodesk Material”. What kind of material can we import from Revit with FBX SDK. The main problem is that a window (for example) will be imported as a single object, and I would like to separate the glass, the frame, the handle, etc, in order to be able to put my materials.

Is there a way to get this informations from Reit’s FBX, or a way to use compatible materials in Revit ? I notice that if I right click a window in Revit and click “Edit Familiy” I got a 3D view of my window, and then I can export it with all the different parts separate. Is there a way to “explode” families like that in the main 3D view ?

I know it’s more a Revit question, maybe I should post in the Revit forum ?

Thanks for any help.



Replies: 2
/userdata/avatar/3yvwf23us_doug100x100.png

Here is a thread about reading materials from Revit:

http://area.autodesk.com/for...iles-exported-from-revit/

Author: Doug Rogers

Replied: 26 November 2010 02:17 AM  
/userdata/avatar/vx3501hqr_small.jpg

Hi Alex, for the question about Revit, you need to post in Revit forum, cause we know little about it :)

Author: Jiayang Xu

Replied: 28 November 2010 05:26 PM  
avatar

Yes, thank you, I read this thread, and it seems to be the same problem, but there isn’t any solution.



Replies: 0