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

Family type for direct shape

$
0
0

Hi

I am creating a direct shape as a generic model.

When direct shape's made, it cant duplicate, rename or doing something normal like regular elements, so is it possible to create family type for it? 

Appreciate for any comments.

Regards


Re: Structural Connections not exported via Document.Export (Revit 2018/Python)

$
0
0

Okey-doke, sorry to hear it, time to ask the development team to take a look.

 

Please provide an absolutely minimal reproducible case:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Presumably, a minimal structural model containing only one or two structural connections that export perfectly well driven manually will suffice, with a (Python?) SharpDevelop macro attempting to export them in the same way that fails.

 

Thank you!

 

Cheers,

 

Jeremy

 

Re: IsCommandAvailable causes nullref exception

$
0
0

Dear John,

 

Thank you for your confirmation and congratulations to hear it is working now, however bizarre the resolution.

 

Cheers,

 

Jeremy

 

Re: Family type for direct shape

$
0
0

If you wish to make direct use of DirectShape element in your model, you can use a category to classify it.

 

It has no family type, since it is not a family instance.

 

If you insist on having a family type for it, you can use the direct shape to create a family definition and insert instances of that family that contain the shape.

 

Please note, however, that one of the main purposes of direct shape was to avoid the need to create a family definition for each and every shape required in the model, and that using the DirectShape element directly is much more efficient than creating a family in some workflows.

 

Cheers,

 

Jeremy

 

Re: How to tell (thru API) if an object is messed up.

$
0
0

I am am not aware of any such check.

 

Maybe your customers should take some basic Revit product usage training before you let them loose on a real projects.

 

Cheers,

 

Jeremy

 

Re: How To Ask If An Element Can Have a Shared Parameter Applied To It?

Re: Does a ViewportDraw system exist in Revit?

Re: Export Revit Api Data to an external database

$
0
0

Welcome to the Revit API!

 

When programming in Revit, you implement either an embedded macro or an add-in DLL.

 

Both of these are built using .NET and any language you choose.

 

Please check out the getting started materials for more info on the basics, and tutorials:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

Within your .NET add-in, you can set up the configuration in any way you please.

 

However, obviously, Revit is not going to do this for you, and I hardly expect that fiddling with the Revit configuration is going to affect this in any way.

 

At least not in the way you would like.

 

Cheers,

 

Jeremy

 


Re: Can I copy the whole project programmatically?

$
0
0

In theory, yes.

 

In practice, no.

 

Why?

 

To read and understand all the elements, their data and relationships stored in the BIM in order to transport it to an external database or another model, you would basically be rewriting the entire Revit engine.

 

I would not consider that a realistic undertaking.

 

I suggest you find some other way to solve your problem.

 

If you just need to move your entire model, or, looking at it differently, your entire coordinate system, you might be able to do something with the MoveElements method:

 

https://apidocs.co/apps/revit/2019/3cf8c9dc-f4d1-12f0-d7a9-e126331cd858.htm

 

Cheers,

 

Jeremy

 

Re: FabricArea.Create failed

$
0
0

Have you found a solution?

 

If not, you might want to attach a minimal reproducible case that clearly demonstrates the problem.

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Oh, before doing that, please verify that the non-vertical case works properly when driven through the user interface, and just fails when driven programmatically.

 

Thank you!

 

Cheers,

 

Jeremy

 

Re: Parameter Filter

$
0
0

Hello,

 

It's working :-)

 

this is the solution:

 

                IList<Element> GenericFamilySymbolList = new List<Element>();

                FilteredElementCollector collector = new FilteredElementCollector(doc);                

                collector.OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_GenericModel).ToElements();

                ElementId id = new ElementId(BuiltInParameter.ALL_MODEL_TYPE_NAME);

                ParameterValueProvider provider = new ParameterValueProvider(id);

                FilterStringRuleEvaluator evaluator = new FilterStringContains();

                FilterRule rule = new FilterStringRule(provider, evaluator, "test", false);

                ElementParameterFilter filter = new ElementParameterFilter(rule);

                GenericFamilySymbolList = collector.WherePasses(filter).ToElements();

Re: Is there a way to export keynote information in the ODBC database?

PromptForFamilyInstancePlacement Disables Some Menu Options

$
0
0

Hello,

 

I am trying to Place a FamilySymbol using PromptForFamilyInstancePlacement method using C# while developing an add-in for Revit. The placement of components using this method disables most of the menu options while placement (as shown in picture 1). While if I try to place the same component directly from Project Browser, the same menu options remain enabled (as shown in picture 2) . Can someone point out something that I should do to match the behavior with Project Browser?

 

 

picture1.PNGPicture1Picture2.PNGPicture2

Here's my code snippet that I am using,

FamilySymbol symbol = HelperMethods.LoadFamilySymbol(familyFilePath, familySymbolName, revitUIApp.ActiveUIDocument.Document);

BCCSCore.Instance.RevitUIApp.ActiveUIDocument.PromptForFamilyInstancePlacement(symbol);

 

 

Any help in this regard would be much appreciated.

 

Thanks,

Umar

 

Re: Parameter Filter

$
0
0

Thank you very much for the nice little sample and solution.

 

It prompts me to reiterate for the umpteenth time:

 

There is generally no need to call ToElements on a filtered element collector.

 

You can use and iterate over the collector directly.

 

The conversion costs time and memory and brings no advantage whatsoever.

 

I mentioned it here and many, many other places:

 

http://thebuildingcoder.typepad.com/blog/2018/08/naveen-zhong-and-deleting-non-shared-project-parameter.html#6

 

Here is a version that skips the conversion:

 

  ElementId id = new ElementId( BuiltInParameter
    .ALL_MODEL_TYPE_NAME );

  ParameterValueProvider provider 
    = new ParameterValueProvider( id );

  FilterStringRuleEvaluator evaluator 
    = new FilterStringContains();

  FilterRule rule = new FilterStringRule( 
    provider, evaluator, "test", false );

  ElementParameterFilter filter 
    = new ElementParameterFilter( rule );

  FilteredElementCollector genericSymbolsNamedTest
    = new FilteredElementCollector( doc )
      .OfClass( typeof( FamilySymbol ) )
      .OfCategory( BuiltInCategory.OST_GenericModel )
      .WherePasses( filter );

  

I added your sample code to The Building Coder samples and optimised it there, so you can see the difference:

 

https://github.com/jeremytammik/the_building_coder_samples/compare/2019.0.143.8...2019.0.143.9

  

Cheers,

 

Jeremy

 

error

$
0
0

como puedo solucioar este problema? El parámetro compartido "049391e0-c9b7-4d13-bcfb-84c309686c1f" no se puede añadir con el nombre "Nominal width" y el tipo "Número" porque entra en conflicto con el nombre "Nominal width" y el tipo "Longitud", ya existentes.


Re: FabricArea.Create failed

$
0
0

Hello Jeremy,

 

I will try to gather all required things if possible.. (I do whole import, so process is more complicated..) But for now I have here a bit detailed description.

There is some simple structure with walls and floors. When I am creating FabricArea, all passes but one wall with XY direction (0.7, 0.7) fails.

There is error message box: Unable to add major direction. Parameter name: majorDirection

 

in GUI there is little difference - I can't pick line (at once) for major direction, but I can pick two points to create line.. then it is visible.

 

now I have 2 attachements.

(1) Revit project,

(2) few lines of info log, that write out info about data (inly IDs) to be then called by FabricArea.Create()

 

 

In fact is seems also in that wall farbic area is created, but not visible in the view..

 

So if I will have some script that would do these calls I will let it here.

 

Thanks for now,

Let me know if you can do something based on that additional info.

 

Greetings,

Jaroslav

 

 

 

Re: My add-in application (VB .net) doesn't appear on addins>external tools

$
0
0

Thank you. I have checked the .dll's properties and it has not been flagged by windows. I have tried with a namespace, without a namespace, with a different class name, with the .dll in the same folder as the addin, and tried doing it all from scratch without renaming the .vb file. Unfortunately it still did not work. It keeps on showing this message, no matter what class name I write:

Failed to initialize the add-in "HelloWorld" because the class "HelloWorld" cannot be found in the add-in assembly.
The FullCassName provides the entry point for Revit to call the add.in application. For Revit to run the add-in, you must ensure this class implements the "Atuodesk. Revit.UI.IExternalCommand" interface.

I think the problem is that it is not finding the class in the assembly.

Re: error

$
0
0

Hi ,

From Google translate,I understood that you are trying to give same name for two shared parameters.
Revit won't allow duplicate parameters with same name even if the types are different.
Better solution would be to add some numbers to the parameter name(e.g)"Nominal width 2"
You can also try using names like "Nominal width name" and "Nominal width Number".

Class cannot be found in the addin assembly VB .net

$
0
0

I just started creating a simple add-in application in VB .net for Revit 2019 by following the tutorial:
https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2014/EN... (from Apr 18 2014).

I have completed all steps successfully, however, when clicking on the button to execute my add-in, this message appears:

 

Failed to initialize the add-in "HelloWorld" because the class "HelloWorld" cannot be found in the add-in assembly.
The FullCassName provides the entry point for Revit to call the add.in application. For Revit to run the add-in, you must ensure this class implements the "Atuodesk. Revit.UI.IExternalCommand" interface.

 

I have checked the .dll's properties and it has not been flagged by windows. I am sure the IExternalCommand is implemented. I have tried with a namespace, without a namespace, with a different class name, with the .dll in the same folder as the addin, and tried doing the tutorial again from scratch without renaming the .vb file. Unfortunately it still did not work: it keeps on showing this message, no matter what class name I write.


I have attached some printscreens of the project and the manifest file.


I think the problem is that it is not finding the class in the assembly because the message is tittled "Wrong Full Class Name". so I must have written this wrong in the manifest file. What should I write them?


Many Thanks.

Re: Class cannot be found in the addin assembly VB .net

$
0
0

Hi ,

 

In your addin manifest file, 

<Assembly>HelloWorld.dll</Assembly>

This won't work because Revit won't be able to find out the HelloWorld.dll file.

 

The correct way to mention the full path of your .dll file is as shown below

For example

<Assembly>D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll</Assembly>

Viewing all 67020 articles
Browse latest View live


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