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

Re: Reloading family symbol fails for the second time

$
0
0

The 'NLRS_C_content_versie' is a type parameter?

 

You are using the LoadFamilySymbol to load a symbol in a existent Family.

 

That's a good questing if the IFamilyLoadOptions should trigger with a FamilySymbol conflict.

 


Re: Reloading family symbol fails for the second time

$
0
0

@ricaun 

Yes, the parameter is a type parameter.

I try to reload it in a project.

 

The IFamilyLoadOptions doesn't trigger.. i guess because the family is already in the project by the first action, but I reloaded a specific symbol. 

I see a remark on the OnFamilyFound bool, it says should only trigger when family is changed, in this case it isnt ...

 

I tried to create a temp file, but nothing works 

Re: Reloading family symbol fails for the second time

$
0
0

Hi @jw.vanasselt,

 

I haven't looked into the full code, maybe a variable is re-used or something...

 

But keep in mind filtering for a Symbol only using it's familyname and typename CAN return others if the Category isn't taken into account. Familynames across categories can be thesame.

Given that with the typename the chance is low. I never use FirstOrDefault in such case, but test the collector on count = 1 (Or use Single/SingleOrDefault) -> Well not for UserFamilies..So would be relative save as long as they aren't named after system families (A window family "Walls" can exist...)

 

Does the Type come from the family file or a TypeCatalog?

Re: Reloading family symbol fails for the second time

$
0
0

From the documentation:

 

LoadFamilySymbol :

Return Value
True if the family type/symbol was loaded successfully into the project, otherwise False. -> So not sure what happens if the type values are changed in the project but the Family file on disk isn't. -> In the UI this won't trigger a warning and no option to overwrite the values of the family type in the project.

If you change something to the Family File (new type + delete type) it's seen as changed, maybe same for the API version?

 

I would test it out with a small controlled code snipplet (fixed family name, maybe even fixed ID...) in the API and see what it does in each situation + identical test in the UI (Same unchanged family and a updated family from disk).

Re: Reloading family symbol fails for the second time

$
0
0

I'm doing some unit test to understand what is happening, and when loading the same family file the LoadFamily return false even if I change the parameters in the symbols. The LoadFamilySymbol return true but the parameter in the type is not replaced.

 

Looks like the main Family need to be changed in some way to make IFamilyLoadOptions to trigger and replace the parameters.

 

If you change the type parameter and try to load the family again, if is the same file does not seen to replace the parameters. I tried to copy the file, and didn't work. Only if I changed the Family and reload in some way in the project.

 

Here is the test project:

 

Re: Reloading family symbol fails for the second time

$
0
0

And what if it's loaded from another location?

The location a family is loaded from is available in the project, so that should update if loaded from another location....

Re: Reloading family symbol fails for the second time

$
0
0

I tried to copy the file to a different folder and Revit is smart to know that is the same file, is not gonna reload a family that is already loaded.

 

ricaun_0-1728674992656.png

 

Re: Material: Use Render Appearance for Shading

$
0
0
Hello!

khanh_phamWU8FK started the post with "used the API to update the color in the Appearance tab", that's just were I am looking for! It's easy to change all colors of the Material, but this is a Asset Color, Right?

Can you share some code how to change the Appearance color of the Asset?
(without changing to a other existing asset)

Thanks in Advance!

Chris Hanschen
LKSVDD architecten
The Netherlands


Re: Transforming of points

$
0
0

Hi @ricaun 

 

   Thanks for your suggestion let me try out this!!! :).

BIM360 / ACC tutorial and examples

$
0
0

Hello everyone,

 

I am a newbie to BIM360/ACC APIs. Until now I used to work with Revit/Navis APIs only.

I asked that same question in the BIM360 API forum - but 0 responses..

I would like to develop a simple app that loads my bim360/acc model (using document management API?) on one part of the screen and reads data from specific elements from that model on the other part of the screen.

I was wondering:

1. If some of my projects are on bim360 and others are on acc - should I develop 2 different apps?

2. Are there any tutorials / free online examples (source code) / templates to help me begin with this kind of development?

 

Thank you!

Purging Unused Fabrication Services in Revit API

$
0
0

Hi everyone,

 

I'm working on a Revit API project and am trying to purge unused fabrication services.

I've encountered a challenge: Revit doesn't allow the unloading of unused services when their corresponding configuration is unloaded.

 

phantbinh99_0-1728717401905.png

 

But when using the Purge command, unused services can be unloaded.

phantbinh99_1-1728717578791.png

 

Currently, I'm using the UnloadServices method to unload unused services, but it's ineffective when the configuration cannot be loaded.
```

fabConfig.ReloadConfiguration();

fabConfig.UnloadServices(unusedServiceIds);
```

Does anyone have a solution for purging unused fabrication services using the Revit API, even when the configuration is unloaded?

I'd appreciate any guidance or suggestions.

Revit crashes while running plugin

$
0
0

Hi guys,

I wrote a modelless form that creates an element by picking two points after clicking a button.It usually runs well, but sometimes it causes Revit to crash without throwing any exceptions.I checked the Revit journal:

"

 C 11-0ct-202412:0057.114;0:< ExceptionCode=0xc0000005 ExceptionFlags=0x0000000 ExceptionAddress=O000FF96A57D8DA'0:< System (MB)[Available / Total ] [Revit Memory Usage (MB) ]

'0:< RAM Statistics: 1415/ 163832768=InUse2777=Peak
' 0:< VM Statistics: 134176630/ 1342177272549=InUse 2560=Peak
'1:;< :104: Delta VM: Avail +8 ->134176633 MB, Used -2->2549 MB;RAM:Avail -23 -> 1391 MB,Used 2768 MB

'1;< DBG INFO: Detected unfrozen change of selection: line 609 of d:ship\2016 px64sourcelrevitlrevitui\modscope\ModScope.cpp'1:<;PERF;MISC,FulUpdateGraphicCacheUpdater:updateAll)DBViewProject id=3651:706 elements need cache update
'1:< ;PERF;MISCFulUpdateGraphicCacheUpdateraupdateAll) DBViewPlan id=6825513 (in RrtLinkInstance id=8214505):16462 elements

"

What is the reason for this problem?

Any help would be great.

 

Re: Reloading family symbol fails for the second time

$
0
0

Thanks for building the test @ricaun !

Well that's exactly the thing I need.

I tried it manual with the same result. 

 

The only method I found is to rename the family with _old and reload the new one.

Any other ideas?

Re: Reloading family symbol fails for the second time

Re: BIM360 / ACC tutorial and examples


Re: Material: Use Render Appearance for Shading

Re: Reloading family symbol fails for the second time

$
0
0

Is you rename you gonna need to find all the instances and replace with the new family, and could be some reference you could forget to swap.

 

Another way would be to open the family changed something without changing and reload in the document. The next time you try to load the same family should be different and IFamilyLoadOptions trigger and the type parameter is replaced.

 

This code force to open the family, change the current type name and rollback, and load back in the document.

FamilyUtils.EditLoadFamily(document, FamilyUtils.SelectFamily(document, FamilyName), (familyDocument) => { using (Transaction transaction = new Transaction(familyDocument)) { transaction.Start("Change Family"); var name = familyDocument.FamilyManager.CurrentType.Name; familyDocument.FamilyManager.RenameCurrentType(name + $" {DateTime.UtcNow.Ticks}"); familyDocument.FamilyManager.RenameCurrentType(name); transaction.Commit(); } });

 

The only problem could be if you have a big document and this could take a while to regenerate the document after reload the family.

 

Here is the FamilyUtils class:

 

Re: Reloading family symbol fails for the second time

$
0
0

That's a nice one will try at monday!

GetRuleParameter Returns Valid ElementId, but doc.GetElement(id) is Null

$
0
0

I’m using rule.GetRuleParameter() (where rule is a FilterRule), and it returns a valid ElementId. However, when I try to retrieve the element using doc.GetElement(id), it always returns null.

 

I’ve checked across all available documents, but the issue persists.

 

Why is this happening, and how can I properly retrieve the rule parameter element?

 

Thanks!

The crop of the associated view is not permitted to have a non-rectangular shape.

$
0
0

Hi everyone,

I am trying to set a view's crop region shape by the code below,

view.GetCropRegionShapeManager().SetCropShape(CurveLoop)

When i run the addin in revit, it gives me "The crop of the associated view is not permitted to have a non-rectangular shape." error. Is there any solution for this?

 

Viewing all 67020 articles
Browse latest View live