![]() ![]() Add the directories with the textures to the Additional render appearance paths.Place all textures into one folder (or multiple, this doesn't matter that much).rfa, depending on what you're creating on Forge). Attach the dummy texture file to the material.Create a dummy texture in working directory, with the correct file name.Send Workitem to Forge, create the materials. ![]() With these, you can do the following operations in order to have full control on creating materials on Forge: If you fire up Revit, you can go to File > Options > Rendering, and under "Additional render appearance paths" field, you can specify the directories on your local machine, that Revit can use to look for missing textures. This is because Revit offers an alternative for re-linking your textures. So, after trying to save the "dummy" texture file somewhere on the Forge C:\ drive, I've found another solution – the texture path for your texture actually does not matter. Any sub-process will also be executed with low privileges.Registry access is mostly restricted, writing to the registry should be avoided.Write access is typically restricted to the job’s working folder.Your application is run with low privileges, and will not be able to freely interact with the Windows OS: This corresponds to what is stated in "Restrictions" area of the Forge documentation: ![]() It is possible to enumerate a lot of these directories, but none of the ones I've tried (and I've tried a lot – mostly the most obvious, public access Windows directories like C:\Users\Public, C:\Program Files, etc.) allow for creation of directories or files. NET Framework installations (as Forge instance is basically some sort of Windows instance with Revit installed). Interestingly, there is a C:\ drive on the Forge instance, which contains Windows, Revit and. I did not find any possible way to create a file on Forge instance, in a directory different than the Workitem working directory which is: Just for clarity – I am going to reference to Autodesk Forge Design Automation API for Revit, simply as "Forge".īasically, the code provided above is correct. Response: Here is my own answer and code sample:Īfter a whole day of research, I pretty much arrived at a satisfying solution. Would you like to share the code you use to create the material and attach the texture for the Revit API add-in developer community to enjoy, either here or in a new thread in the Revit API discussion forum? The perfect outcome for me would be if I could somehow map the material texture path to some user-friendly directory like C:\Textures\texture.png and it seems that the Forge instance has a C:\ drive present (being probably a Windows instance of some sorts), but my code runs on low privileges, so it cannot create any kind of directories or files outside the working directory.ĭoes somebody have any idea how this could be resolved?Īnswer: Congratulations on getting to this point. This path is useless, because a material with texture path like this needs to be manually re-linked in Revit. Which is basically the working folder for the Workitem instance. The problem is that this sets the texture path for the material as something like this: I do not have this file on the cloud instance of Forge, because the path to the texture name is specified by the user when he sends the request for the work item. Needs to be a reference to an existing file. This is actually working well, as the value for the texture path: TexturePath = Path.GetFullPath( "texture.png" ) = ( AssetPropertyString) connectedAsset.FindByName( If( asset.NumberOfConnectedProperties = 0 )Īsset.AddConnectedAsset( "UnifiedBitmapSchema" ) ĬonnectedAsset = ( Asset) asset.GetConnectedProperty( 0 ) Question: I'm currently working on some Revit API code which is running in the Autodesk Forge Design Automation cloud solution.īasically, I'm trying to create a material and attach a texture to it via the following code: private void AddTexturePath( Where maleficca very kindly shares a complete solution for both environments: On creating a material with texture in Autodesk Revit Forge Design Automation, It came up again in the context of Forge in the StackOverflow question This topic has been very much en vogue lately.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |