View Full Version : Material Issues
joeb.89055
2005-06-15, 08:50 PM
I'm trying to write an external command that simply exports all of the geometry and materials a specific format. Geometry is no problem, and any materials that are attached to a face are no problem. However, I can't seem to find any more materials. If I do a type check on every _Autodesk_Revit_Element I will see 11 materials in the scene, but only get 4.
It seems to me that it has something to Families/Categories, or anything further up the hierarchy. But in the API documentation it makes no mention of materials (at least not in the sense that I am looking for).
Any help would be greatly appreciated. BTW, I'm using C++ to code this external command.
-Joe Bacigalupa
Joe,
I'm not sure if this is what you want to know but..
Reading between the lines you're trying to export geometry and texture material information to another format. (Very exciting by the way).
AFAICT the only material information the existing API exposes is physical material related to structural settings. Hence the 4 types (concrete, wood,steel, other). In Autodesk's defense the existing API has always been orientated towards structural requirements. If you're working in C++ you're probably a professional programmer so I would suggest contacting one of the Revit developers off-list and they might be able to help you further.
If the geometry translation is working OK (again very exciting) and you can extract the UV information then perhaps a compromise at the moment is to apply some dummy material names.
Care to tell us which format you're trying to export too ;-) I had to ask didn't I :-)
Guy
joeb.89055
2005-06-16, 01:12 PM
I am currently exporting to VRMesh format, I'm not sure if you've heard of VRay, but its a pretty popular renderer for Max, and they are currently in the process of making it standalone.
Essentially, as far as materials go, I just want to find which materials are attached to what, the actual material parameters are not too much of an issue right now. I just want to be able to import it and make a multimaterial with the correct number of channels as well as well as the correct material names, so then the 3d guys can tell what each material is supposed to be. I think I have found a way to do this. I'll post a solution if I am correct.
Thanks for your quick response!
czoog
2005-06-16, 02:30 PM
I am currently exporting to VRMesh format, I'm not sure if you've heard of VRay, but its a pretty popular renderer for Max, and they are currently in the process of making it standalone.
Essentially, as far as materials go, I just want to find which materials are attached to what, the actual material parameters are not too much of an issue right now. I just want to be able to import it and make a multimaterial with the correct number of channels as well as well as the correct material names, so then the 3d guys can tell what each material is supposed to be. I think I have found a way to do this. I'll post a solution if I am correct.
Thanks for your quick response!Woah! you are exporting revit models to Vray Meshes!?! Sweet! We use Vray here and have come to rely heavily on vray meshes for large scenes. The amount of memory they save is amzing. Good luck, and let me know if you need a beta tester for anything;)
Hey you don't happen to work with a guy named Corey (from the vray forums) do you?
-Z
joeb.89055
2005-06-16, 03:15 PM
Woah! you are exporting revit models to Vray Meshes!?! Sweet! We use Vray here and have come to rely heavily on vray meshes for large scenes. The amount of memory they save is amzing. Good luck, and let me know if you need a beta tester for anything;)
Hey you don't happen to work with a guy named Corey (from the vray forums) do you?
-Z
Yep, he's my boss. I'm sure he'll announce our progress on those forums. As of now, however, the exporter is pretty rudimentary. It gets all the geometry, and gets all materials (but currently without any actual material information...just names). Hopefully soon we'll have something for you to test =)
-Joe Bacigalupa
czoog
2005-06-17, 01:14 AM
Yep, he's my boss. I'm sure he'll announce our progress on those forums. As of now, however, the exporter is pretty rudimentary. It gets all the geometry, and gets all materials (but currently without any actual material information...just names). Hopefully soon we'll have something for you to test =)
-Joe Bacigalupa
Cool, can't wait to see what you guys are cooking up.
-Z
joeb.89055
2005-06-17, 03:07 PM
If you're working in C++ you're probably a professional programmer so I would suggest contacting one of the Revit developers off-list and they might be able to help you further.
What do you mean by contacting a Revit developer off-list? I could use a little guidance. Thanks in advance.
-Joe
hand471037
2005-06-17, 04:24 PM
Joe- it's not a good solution, mind you, but all the Material information is captured as XML files at the end of a 3D DXF Revit export. I know that you probably don't want a two-step export process. However, there is enough info in there to probably re-assemble your Vray material on the other end. If you could get Revit to hiddenly export a DXF, and then just parse the end & throw it away, you could get all your materials the way you wanted them as part of your export tool... it's not pretty tho.
Very exciting to see someone working on this!
joeb.89055
2005-06-17, 06:41 PM
yea, I'd rather streamline it as much as possible. I know all this damn information is floating around in here somewhere ;) I just need to figure out the parameters and stuff like that..Lots of trial and error going on, but thanks for the idea, I may look into that, but I think it may add a little too much time to the export process...Right now I've managed to keep it pretty quick. Thanks again
-Joe Bacigalupa
For serious development you'll do yourself a great favor by signing up with the ADN. Revit developers might give you pointers if they feel like it, but that's not a reliable way to do business. ;-)
Now, I didn't catch what exactly the problem is. You see 11 materials in the project, but only 4 are actually used?
By the way, the MaterialElement you get from a Geometry.Face or a Geometry.Element will give you a few appearance properties (color, transparency, etc.) if you query its parameters.
joeb.89055
2005-06-17, 08:01 PM
This is the problem in a nutshell. I go through all Family definitions and search through all of their parameters for materials. I find all the materials that are a part of that Family with no problem. When I get a FamilyInstance it has one symbol in it, so I look it up (by name) and figure out what material is attached to it.
For some reason this is not working.
Here is an example. You have a window that is made up of trim and frame/mullion and all that good stuff. Now when I get this family instance, I'm expecting that each family instance's symbol is one part of that window (the frame, the trim, etc), but it isn't. Its the whole window(or so it seems), so the window does not get all of its materials attached to it.
So that is my problem. I hope that makes more sense. Maybe ADN is the only option..:(
-Joe
joeb.89055
2005-06-17, 08:57 PM
Essentially, I just don't understand how to separate materials on a family instance when the material parameters are inside the FamilySymbol (which has no geometry) and the Family has the geometry (but no materials), and the FamilyInstance is an instance of the Family's geometry. I'm just lost.
I was assuming that I could just define each family once and then when I came across an instance I would just go through each of the family's symbols and apply some transform to the geometry and slap a material on it. But it just doesn't seem to be organized like this in Revit.
Ah well. I guess I'll just keep pluggin' away
-Joe
crubadue
2005-06-17, 09:21 PM
FK-
Until our ADN questions are answered, application is approved, and our bill is paid I promise your help is greatly appreciated!
Regards,
Corey Rubadue
What do you mean by contacting a Revit developer off-list? I could use a little guidance. Thanks in advance.
All I meant was as a professional developer (guessing as C++) you might not want to reveal your plans in this forum and the Revit developers are very easy to contact through the forum PM's.
BTW I'd be interested to know if you've tried linked models? Can you access the geometry data from the linked models? I couldn't see a way. Definitely one for the API wishlist.
Guy
joeb.89055
2005-06-20, 12:46 PM
BTW I'd be interested to know if you've tried linked models? Can you access the geometry data from the linked models? I couldn't see a way. Definitely one for the API wishlist.
Guy
I haven't tried that yet, I'll let you know if I come across a way to do that.
-Joe
James.Lupton
2005-07-01, 12:53 AM
I for one think ADN is a great way forward but the problem comes when you try to cost justify membership.
I think most of us are trying to get to grips with the basics of the API to see if we can make use of it.
Is there no easy entry option to get us going.
As with Revit subscription we will need ADN subscription when our business relies on it.
The sooner we get to grips with the API then the sooner the need for ADN will be upon us. however subscription is too expensive if we only find out we cant do what we need to do with the API.
For those who have access to the knowledge base at ADN, please help us to understand how to get going and I am sure that before long we will need our subscription.
Regards
James Lupton
Is there no easy entry option to get us going.
The examples give you a pretty good idea. And the help file isn't that bad. If someone can find time to finish and package it there should be a scripting option soonish as well ;-)
The sooner we get to grips with the API then the sooner the need for ADN will be upon us. however subscription is too expensive if we only find out we cant do what we need to do with the API.
ADN is cheap for the target audience, professional programmers. ADN is probably most useful for finding out what's coming and pushing missing API features you want. At this stage I don't find the API that complicated. Is their a particular issues you're having trouble with? There are a few of us that have done a little programming and may be able to help.
Guy
James.Lupton
2005-07-01, 06:20 PM
Guy
I am sure ADN is value for money however, it is just the getting started bit which we need to get through to be convinced we are able to put it to use.
One particular thing we would like to do is to populate a text parameter with a label generated from a number of parameters in the family.
The functionality I envisage is
Select an object
Run an external command
The command will create a text string (or perhaps a number) derived from the other parameters in the family and then replace the contents of a different parameter "Labelstring" with the text string ( or number) just evaluated.
Do you think this is possible?
How do I get started to try it out.
Regards
James Lupton
James,
I am sure ADN is value for money however
I'm only guessing because I'm not an ADN member just an amateur like yourself.
Do you think this is possible?
Yes
How do I get started to try it out.
Select your language of choice, read the API help file and try the examples. If you have little or no programming experience and can wait a little while then what I'm working on (pyRevit) may be an easier route for you.
Guy
Implement the IExternalCommand interface. This will get you the selected elements. Figure out how to read parameters. I'm not sure you can change parameters though...
I'm not sure you can change parameters though...
I haven't tried this yet but:
Autodesk.Revit.Parameter has a method Set which looks to be able to set parameter values.
Set has the following description:
Set the parameter to a new element id.
Overload List
Set the parameter to a new element id.
public int Set(ref ElementId);
Set the parameter to a new real number value.
public int Set(double);
Set the parameter to a new integer value.
public int Set(int);
Set the parameter to a new string of text.
public int Set(string);
This is what I was going to try.
Guy
Yeah, I saw that too, but I was not sure it actually changed the element. Looks like it does. Make sure to check the return value.
Powered by vBulletin® Version 4.1.11 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.