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

Re: How do I get parameters from the children of a family

$
0
0

The direct answer is to call FamilyInstance.GetSubComponentIds(), and filter them for the desired child family instances.

 

If you can collect the child families directly via a standard FilteredElementCollector though, I suggest that route.  And if identifying the parent is necessary, find it by walking up the family tree.  Here are some helpers I use for this very scenario.

 

        public static bool IsNested(this FamilyInstance instance)
        {
            var isNested = instance.SuperComponent is FamilyInstance;

            return isNested;
        }

        public static bool IsTopLevel(this FamilyInstance instance)
        {
            var isTopLevel = instance.SuperComponent == null;

            return isTopLevel;
        }

        public static FamilyInstance GetParent(this FamilyInstance instance)
        {
            var parent = (FamilyInstance) instance.SuperComponent;

            return parent;
        }

How can change BuiltInParameterGroup

$
0
0

It is possible to change the group to a parameter, for example, change the "Sill Height" parameter from the "Constrains" group to the "Dimensions" group by code from inside a Revit project or at the moment the Family creation by code?

 

Thanks...

Re: Large sample revit files for performance testing

$
0
0

Hello guys, do you have new location for big Revit model to test performance? Dropbox seems has closed access there.

Re: Central Model

$
0
0

hmmm.. well let's think a bit out of programming.

Practically you will not upgrade a central model without :

  1. asking the entire team to synchronize their work
  2. assuming the project is life and running, upgrading a shared model for architecture will also require the rest of disciplines. which means they all for each need to synchronize their works
  3. assuming the project is closed and you are only upgrading for the purpose of keeping the revit files upto score, then there is no need to sync local files as there is no one already working on.

by then you can use the api to upgrade the model.

 

another possible one which i do not recommend is to ask your team to copy their local files to a single shared one and loop through them all for syncing and then upgrade the central model. 

 

thoughts?

Re: How can change BuiltInParameterGroup

$
0
0

Hi,

I don't think this will be possible for the builtin Parameters, but of course you can for Project and shared parameters created by users.

 

Hope that helps.

Re: GetLightSourceTransform() in DocumentChanged Event

$
0
0

Hi,

most likely you can not because your current session is under Transaction. meaning, you can not open a familydocument while your current project is in transaction. 

 

Hope that helps

Re: Set other virtual printer as default in Revit

$
0
0

Hi,

After setting new printer you need to recall PrinManagerAgain, to acquire the updates

m_printMgr = doc.PrintManager 

 Hope that helps

 

Re: How to find RevitCommandId of all commands in single application?


Re: Load Custom pat file

$
0
0

AFAIK, it is not yet possible to import pattern file through API.

Re: Topography Parameters

Re: Large sample revit files for performance testing

Re: How to set smooth line with anti - aliasing for Current View ?

$
0
0

hi,

you need to first set the linestyle of the Silhouette Edges, so that enabling the Silhouette have a proper line style to display

var lstyles = new FilteredElementCollector(doc).OfClass(typeof(GraphicsStyle));
var lstyl = lstyles.Where(o => o.Name.Contains(mylinestylename)).FirstOrDefault();
displayModel.SilhouetteEdgesGStyleId = lstyl;

 

Re: Dimension on Hatch Pattern Slab

$
0
0

Now any idea about how to get the actual geometry of the gridline from Reference? Let's say to create a model line that overlaps the gridline?

How to create marker for sockets?

$
0
0

Hello!
Help me please!
How to create marker for sockets and move location? C# C# C#

Can you help in the code?

Is there an example of a code?(for sockets)

Thanks!

Re: Cut wall with wall (embedded wall) with revit api

$
0
0

I believe you need to join the embedded walls so the cut family apply its effect. try this via UI first,

1. create a wall.

2. add the void cut family

3. create the 2nd wall

4. Join the 2 walls.

 

hope that helps

 

I tried replying on your PM but something is wrong, keeps saying i reached my limits of PM!!!


Re: Behavior of ElementTransformUtils.CopyElements when copying an external RVT

$
0
0

Thank you very much for the reply.

 

That is exactly what I did even in the previous program that I made. It only copies the views from a source document and pastes on the destination document (in my case, the current document). However, it does not copy the elements into the DESTINATION VIEW of the destination document, which I wanted and expected especially the below CopyElements function to do.

 

ElementTransformUtils.CopyElements(View, ICollection<ElementId>, View, Transform);

 

Or did I miss something essential while doing this?

 

Additionally, the above function eventually opens all the views that it copied. I wanted to close these views, but I couldn't because the views open once the command has finished (and I can't think of a way to intercept this process, and even through UIView did not help). Is there a way I can close these views?

Re: How do I get parameters from the children of a family

$
0
0

Okay, so what do we do when; even though we explicitly know the family tree exists; the GetSubComponentIds function does not return any values SubComponentIds?

Re: Behavior of ElementTransformUtils.CopyElements when copying an external RVT

$
0
0

Hi  ,

Follow these steps

1)Start a transaction for your source document

2)Start a transaction for your destination document

3)Create a list and add the elements from the source document to the list. Now you will have a list of elementids to copy

4)filter for the view to which you want to copy the element and get the view. Now you will have source view and destination view

5)Now use ElementTransformUtils.CopyElements(sourceview,IList<elementid>,destinationview,transform,CopypasteOption) to place the elements to the desired view of new document.

 Document activedoc;
 Document newdoc;//List of Elements to copy
 IList<ElementId> eids = new List<ElementId>();

 CopyPasteOptions CPO = new CopyPasteOptions();
 CPO.SetDuplicateTypeNamesHandler(new CopyUseDestination());

//Get the required view from new document
Autodesk.Revit.DB.View newView = null;
FilteredElementCollector collector = new FilteredElementCollector(newdoc).OfClass(typeof(Autodesk.Revit.DB.View)).WhereElementIsNotElementType();
foreach(Autodesk.Revit.DB.View v in collector)
 {
   if(v.Name.Contains(activedoc.ActiveView.Name))
       {
         newView = v as Autodesk.Revit.DB.View;
         break;
        }
   }//Copy ELEMENTS
 ElementTransformUtils.CopyElements(activedoc.ActiveView,eids,newView,Transform.Identity,CPO);

6)commit destination document transaction

7)commit source document transaction

 

 

 I hope this helps.

 

Re: How do I get parameters from the children of a family

$
0
0

Hi,

 

what exactly is the problem?

 

That you don't have the FamilyInstance object if you drag'n'dropped your window into the document?

 

If that's correct, you could register for DocumentChanged event before dropping.

After that, you can check the added elements and pick your window instance by its name etc.

Finally, unregister from DocumentChanged event.

 

 

Revitalizer

Re: How do I get parameters from the children of a family

$
0
0

Hi,

 

you also could implement an IUpdater that reacts to newly created window FamilyInstances.

So, after dragging and dropping, you can read/write their parameters.

 

Revitalizer

Viewing all 66666 articles
Browse latest View live


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