Quantcast
Channel: All Revit API Forum posts
Viewing all 66672 articles
Browse latest View live

Re: Heating and cooling load Analytical Surfaces with Revit API

$
0
0

Yes, you can extract the required data via the Revit API as well.

 

The main support for this is provided by the EnergyAnalysisDetailModel class that also underlies the gbXML export, afaik:

 

 

It supports two different types of analysis:

 

 

There are lots of other ways to tweak it as well.

 


Re: Revit 2021 Version Information Issue

$
0
0

Good question. I asked the development team for you.

 

Re: [Revit API] Converts a "Revit Elements" to solids and creates a fa

$
0
0

Hi Jeremy,

 

DirectShape cannot be edited by the user, so FreeFormElement is the right sort of element.

FreeFormElement.Create(doc, solid) - and you are done.

 

 

Rudi

Re: Revit 2021 Version Information Issue

$
0
0

Jeremy,

 

Thanks, let us know what you find out.

 

Todd

Locked Parameter value

$
0
0

I want to make one of type parameter to be modified by a specific person and not allow anyone to modify, there is any way?

 

Re: Locked Parameter value

$
0
0

Not really.

 

Option 1:

You can create a shared parameter with UserModifiable set to false in the ExternalDefinition so that only an addin can write to it and then control who writes to it via an addin reviewing user details. However this is not what UserModifiable was intended for. It was intended to give read only parameters for addins, so therefore you can write to such parameters even through macros.

 

Option 2:

Subscribe to DocumentChanged event or implement dynamic model updater to look for such changes to the parameter and then restore the previous value from an extensible storage backing if the user change was not permitted.

 

Option 3:

Similar to 2 above but instead of restoring the value you post a custom failure. Posting Failures is usually used with dynamic model updaters.

 

Option 2 and 3 are reliant on the addin being installed on the PC of the user you don't want to update the parameter. Deleting of .addin files etc. can probably be controlled for file permissions.

 

If the aim is to send out the model to a third party then get it back and know that they haven't changed items they shouldn't have then you can probably audit the model at certain stages to ensure certain parameters are not being populated. Easiest method is to keep a version of the model back and use that for comparison. A system of unique IDs needs to be developed to ensure that elements from two models can be mapped in a reliable way.

 

Re: Unique Model Ids without storing anything to models

Re: The document was opened detached, so saveascentral must be set to true?

$
0
0

Yes, I apologize, I didn't include this in my original code (I accidentally skipped a line while copying it) but I do have it set to 

openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets;

and yet, it still gives me that error. That is why I am so confused...


How to create image as parameter in a family

$
0
0

Hi everyone,

I am trying to add a new parameter to a family, in order to get that I do this 

var familySymbol = (FamilySymbol)annotation.ToList()?.First(); var famDoc = this._uiDocument.Document.EditFamily(family.Family); using (var trans = new Transaction(famDoc)) { trans.Start("Adding parameter"); var parameterType = ParameterType.Image; famDoc.FamilyManager.AddParameter("Symbol image", BuiltInParameterGroup.INVALID, parameterType, true); trans.Commit(); }

But a error occurs,  "Instance parameter of image type is not allowed."

Can I add a image as a parameter using Revit Api?

Re: Set material to a family intance

$
0
0

Thanks Jeremy, I will look at your post about the material discussed in detail, to see if I can solve the problem.

Re: Update the views

$
0
0

Hi , 

Thanks for your generous response.

i managed to do the synchronization via a command and it works fine.

i need to do it automatically when the user pan or zoom in or zoom out.

i tried the Idling event but it doesn't seem to be triggered by panning or zooming, can you help me how to trigger the Idling event.

Thanks a lot.

Best practices to test worksharing end-to-end

$
0
0

This is not directly Revizt-API associated. I ask here to get to know how the Autodesk RnD/QA-teams do end-to-end tests to test worksharing aspects.

 

Until Revit 2019 one of our developers/testers could test worksharing behaviour on the same PC/windows session, by simulating different Revit users by using different Revit user names:

* The tester opened two Revit instances.

* He/She logged out both Revit instances from Autodesk 360.

Capture2.PNG

* The tester could change the username for both Revit instances individually (running on same PC/Window login)

Capture.PNG

* The tester could go on creating the central project, local file for Revit-Instance1 and Revit-Instance2 (running on same PC & same account)

 

Since Autodesk 2020 you are forced to login to you Autodesk-Manage account (I think because of licensing issues). So our testing workflow above is broken.

 

The break of the testing-workflow came up, as the testers had to work at home this year and having only one PC at home.

 

I searched the API forum and the support page and found this document:

https://knowledge.autodesk.com/de/search-result/caas/sfdcarticles/sfdcarticles/DEU/Worksharing-issues-when-multiple-users-work-on-a-Revit-workshared-model-with-the-same-username.html

 

It says to logging into different accounts. We did so, login into accounts of our colleagues, but while we tried to logging the second Revit-Instance as a different autodesk user (on the same PC & Windows account), the following error appeared:

bla.jpg 

 

Is there any way to keep our testing workflows, running two Revit instances on the same PC with different user-names?

We are wondering, how Autodesk testers run manual end-to-end Worksharing tests? Do you need two testers? Do you need two manage.autodesk accounts?

 

Thank you

Harald

Project Browser Colours

$
0
0

Hello all,

 

I know that it is possible to change colours and other modifications to the Ribbon through the Revit API.

But I was wondering if it is possible to change the colours of the project browser.

It would be cool if I could change to red the families that are not named properly.

Is this possible?

 

Many thanks.

Re: How to create image as parameter in a family

$
0
0

The message is telling you that parameter types of ParameterType.Image can only be used for Type parameters, this is the same as in the UI. Therefore:

 

.AddParameter("Image 1", BuiltInParameterGroup.INVALID, ParameterType.Image, False)

Will work.

.AddParameter("Image 1", BuiltInParameterGroup.INVALID, ParameterType.Image, True)

Will not work.

Empty dockable panel

$
0
0

Hello all,

 

I am doing some tests with dockable panels. So far I managed to register and show the panel with a button in the Ribbon.

But the Dockable panel comes empty (without the content, just grey).

 

I register the dockable on startup like this (external application):

DockablePaneProviderData DockPanelData = new DockablePaneProviderData(); DockablePanel myDockablePanel = new DockablePanel(); DockPanelData.FrameworkElement = myDockablePanel as System.Windows.FrameworkElement; DockPanelData.InitialState = new DockablePaneState(); DockPanelData.InitialState.DockPosition = DockPosition.Right; DockablePaneId myDockablePanelID = new DockablePaneId(new Guid("{28ad1242-3be7-453d-b9cd-1a229ab40a4f}")); application.RegisterDockablePane(myDockablePanelID, "FCBS BIM Docs", myDockablePanel as IDockablePaneProvider); myDockablePanel.SetupDockablePane(DockPanelData);

I show the panel like this:

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { DockablePaneId dpid = new DockablePaneId(new Guid("{28ad1242-3be7-453d-b9cd-1a229ab40a4f}")); DockablePane dp = commandData.Application.GetDockablePane(dpid); dp.Show(); return Result.Succeeded; }

The c# code of the xaml is as below. Note that I get a warning in the "Page" inheritance that says "Partial declarations of 'DockablePanel' must not specify different base classes":

public partial class DockablePanel : Page, Autodesk.Revit.UI.IDockablePaneProvider { public DockablePanel() { InitializeComponent(); } public void SetupDockablePane(DockablePaneProviderData data) { data.FrameworkElement = this as FrameworkElement; data.InitialState = new Autodesk.Revit.UI.DockablePaneState(); data.InitialState.DockPosition = DockPosition.Tabbed; data.InitialState.TabBehind = DockablePanes.BuiltInDockablePanes.ProjectBrowser; } private void myCustomButton_Click(object sender, RoutedEventArgs e) { } }

And the Xaml:

<Window x:Class="FCBS_Tools.Dockable_Panel.DockablePanel" xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" Title="Dockable Dialogs" Height="500" Width="200" x:Name="DockableDialogs" Background="LightGray" Loaded="DockableDialogs_Loaded"><Grid><StackPanel><Button Click="myCusButton_Click"> Test </Button></StackPanel></Grid></Window>

 

Any help is welcome. Thanks


Re: Empty dockable panel

$
0
0

Fixed! I just had to change <Window> for <Page>. The problems of copy-paste!

Re: Creating dimension for legend component - Dimension not showing

$
0
0

Hi again, Im still working on this. I dont have many time as this is not my professional ocupation right now. While I do this I mark your post as the accepted solution cause I think is the better approach to this. Anyway, in case that its of interest of someone reading this, I have faced a couple of problems with this code:

 

-First one. Geometryelement doesn´t show "real" geometry faces for complex geometry. If I run this on a prismatic pure volume, the output is:

*2 Solids, one of them without edges or faces, and the other one containing the real geometry (6 faces and 12 edges)

Captura de pantalla 2020-05-04 18.52.49.png

While if done with an standar door:

*Some lines and 2 solids, in this case both of them with 0 faces or edges.

Captura de pantalla 2020-05-04 18.55.21.png 

This behaviour lead me to think that this should be done with other entity.

 

 

-Second one is figuring out how to manage that faces to use must be the total widht and height of the component (those intersecting BoundingBox). I thought to use Face.Intersect Method (Face), but then I struggle trying to create a face from bounding box.

 

Thank you TripleM-Dev.net. Regards.

Re: Set material to a family intance

$
0
0

Element dpes not have a Set method. You probably want to do 

pMatSimbolo.Set(matId);

Re: Best practices to test worksharing end-to-end

$
0
0

If you have a second login available with manage.autodesk, what would be the downside of spinning up a VM and installing Revit in the VM context? VM could still have access to a network to either connect to BIM360 design or to a local network where the central model resides.

 

You could also spin up your VM, install a trial, run the tests, and then kill the VM after 30 days. Then reset the VM and do another trial. Kind of a hack, but would get the job done.

 

Depends on where you are doing testing as well. Both methods could become a big pain if you are working with a dll that you are constantly updating.

 

And the 2nd version might not be in line with the licensing agreements. Don't take legal advice from a forum post. etc. etc.

Retrieve current folder path

$
0
0

Hi forum. Im trying to access to the Addins folder in which my dlls are installed:

 

C:\ProgramData\Autodesk\Revit\Addins\2019

 

 

I have tried: 

System.IO.Path.GetDirectoryName(Application.ExecutablePath);

wich output:

C:\Program Files\Autodesk\Revit 2019

 

And also tried:

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)

wich output:

C:\ProgramData

 

I can certainly add "\Autodesk\Revit\Addins\2019\" to the last one, but I wouldnt want to add this manually cause maybe someone change the instalation folder (is this even possible?) or the addins folder. Is there a way to retrieve "C:\ProgramData\Autodesk\Revit\Addins\2019" or wherever my dlls is placed with a single command order to minimize errors?

 

Regards.

Viewing all 66672 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>