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

GetRoomAtPoint() with design options

$
0
0

Hi all,

 

GetRoomAtPoint seems to ignore rooms within design options, even if the rooms are in primary options. To be more precise the results are returned from either the active option or the main model if no option is active. The problem persists as I need need to query different option sets and main model in the same operation.

Is there an alternative route to find room at a point that is compatible with design options?

The only route I can think of is generating solids from the rooms and then calculating intersections, but it feels heavy-handed for something that is default behaviour within revit?

Another possible route would be to iterate through the different primary design options setting each of them to active briefly, but I don’t think you can do that programmatically.

 

Many thanks

 

Tiago


Re: Register Dockable Pane

$
0
0

Hi friend,

 

     1. Do you implement interface IDockablePaneProvider for your Dockable Pane?

     2. Do you use dp.Show() to display your Dockable Pane

 

     Maybe you can post your Exception details that everyone can help you as soon as possible :)

 

Best Regards

Frank Liang

TJAD

Re: GetRoomAtPoint() with design options

$
0
0

you can use a filtered elementcollector for all the rooms, on a level, in a phase and in a design option.

then use the Room.IsPointInRoom() method to find the room "atpoint".

	public static class Util
	{
		static public  Room GetRoomAtPoint(this Document doc, ElementId levelID, ElementId PhaseID, ElementId DesignOptionID, XYZ pnt)
		{
			ElementDesignOptionFilter designfilter  = new ElementDesignOptionFilter(DesignOptionID,false);
			FilterRule levelrule = ParameterFilterRuleFactory.CreateEqualsRule(new ElementId(BuiltInParameter.ROOM_LEVEL_ID),levelID);
			FilterRule phaserule = ParameterFilterRuleFactory.CreateEqualsRule(new ElementId(BuiltInParameter.ROOM_PHASE_ID),PhaseID);
			ElementParameterFilter filter = new ElementParameterFilter(new List<FilterRule>(){levelrule,phaserule});
			IEnumerable<Room> rooms = new FilteredElementCollector(doc)
				.OfClass(typeof(SpatialElement))
				.OfCategory(BuiltInCategory.OST_Rooms)
				.WherePasses(designfilter)
				.WherePasses(filter)
				.Cast<Room>();
			Room res = null;
			foreach(Room r in rooms)
			{
				if (!r.IsPointInRoom(pnt)) continue;
				res =r;
				break;
			}
			return res;
		}
}

Modify PropertyLine

$
0
0

Hello,

I try to copy and modify a PropertyLine.  But the line has an different ID when it is in the "sketching-modus" as if the sketching is finished and only the ID/line from the sketching-modus has a location.

So how can I get the "sketching-modus" Id with the API?

Or is there an other solution to modify the line?

 

Thanks.

 

 

Re: Explode SAT/DWG after import

$
0
0

Thank you  

As the tutorial suggests, I was able to use the get_geometry() method to iterate through the geometries in imported element and look for solids. Then I'm using FreeFormElement.Create(doc, solid) to recreate the solid(s).

I tested this on an SAT file I made in Rhino, the file has one cube and one cylinder. Once imported into Revit and going through the workflow above, the result is both cube and cylinder in one single FreeFormElement. (see screenshot attached)

I was expecting two separate elements. Am I missing something? or is it SAT property that doesn't break down to primitive geometry?

 

Thanks,

-Morteza

Re: Perspective View 2019 Field of View

$
0
0

I tried to create a brand new Arch model and could not reproduce the issue, so I used the sample one and was able to. In the attached model there is a 3d view that I had active when I loaded the module, creating that copy that should have the correct FoV. It is slightly too wide though. 

Re: GetRoomAtPoint() with design options

Re: Connect automatically Power BI to Revit to create project dashboards.

$
0
0

Hi, did Jeremy sponsored you to present at AU at the end?

 

Thanks


Re: REvit Model Checker - accessing View Filters

$
0
0

I am trying to filter pipe tags who have lost their host.

 

Category OST_PipeTags

AND API Parameter IsOrphaned Defined True

AND Type or Instance = False

 

Shouldn't this work? seems like such an easy test but it is stumping me!

Re: Connect automatically Power BI to Revit to create project dashboards.

$
0
0

Nope, sorry. I do not have any influence whatsoever on AU class selection.

 

Re: read and export schedules multiple revit file using c# api

$
0
0

I already answered your identical question on StackOverflow:

 

https://stackoverflow.com/questions/54755603/read-and-export-schedules-multiple-revit-file-using-c-sharp-api

 

I repeat it here for the sake of completeness:

 

Yes, indeed.

 

You cannot make it work like that.

 

You cannot drive Revit from outside just like that.

 

You can, however, use Idling and External Events for Modeless Access and Driving Revit from Outside:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28

 

However, for the scenario you describe, the easiest solution will be to write a simple external command and launch that from inside Revit to drive the required functionality. Modal, not modeless.

 

Implementing an external command is easy and covered in full right at the beginning of the material on getting started with the Revit API:

 

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

 

Furthermore, you are in luck, because the functionality you describe is implemented by an existing sample described by The Building Coder on The Schedule API and Access to Schedule Data:

 

https://thebuildingcoder.typepad.com/blog/2012/05/the-schedule-api-and-access-to-schedule-data.html

 

Good luck and have fun.

 

Jeremy

 

Re: Modify PropertyLine

$
0
0

Dear Sebastian,

 

Thank you for your query.

 

I am afraid that I do not know what you are talking about.

 

It seems to me that the behaviour you describe is Dynamo specific and not part of the Revit API.

 

Probably the people over in the Dynamo forum will be able to help you better than here:

 

https://forum.dynamobim.com

 

Good luck resolving this!

 

Best regards,

 

Jeremy

 

Re: Perspective View 2019 Field of View

$
0
0

Dear John,

 

Thank you for your reproducible case.

 

I logged the issue REVIT-144199 [setting 90 degrees FOV works in Rvt 2018 and not in 2019] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

I let you know as soon as I hear back from them with any news.

 

Best regards,

 

Jeremy

 

Re: External Command Initialization issue

$
0
0

I agree with Jeremy for C#. 

 

If you are using Python, I've found it to be a little more picky when copying and pasting code.  Python uses white space or "returns" to determine where one line ends and another line starts.   And it seems like some white space is different than others.  Maybe spaces or tabs confuse it.  Or maybe there are even different types of "returns" or "new lines" that can be used by different programs.


But I assume you are using C#.  So like Jeremy said, it must be something else.

 

Are you trying to rename a namespace or file name?   Sometimes there is some "behind the scenes" code that needs changed to match. 

 

But to be honest, I'm not exactly sure when or what.  I don't think its a problem with class names, but I think it is with project names and namespaces.  

 

And sometimes, when you rename something, visual studio will ask if you want to update references, and sometimes not.

 

So I just try to avoid renaming any namespaces or files.   

Re: External Command Initialization issue

$
0
0

yes C#

 

Here is why i am confused. I have lots of code snippets for LinQ SQL etc. Just getting into Revit C#. None of the other ones throw an error at build or debug. (Unless i screw up and mistype etc.)

Only Revit and only this statement. So here is my two processes.

1. Type all the function declarations by hand, then the body and bam it builds.

2. Use clipboard or snippet, type the class body and build hangs on the .execute method of the function. 

Delete the function statement ONLY and type it as above. Builds. Copy from same working class and paste back into same class. Error. Makes absolutely no sense and only occurs on the Revit classes that are external commands. I have checked for spaces Case everything. VS is able to detect and suggest corrections for all of that. 

 


Extraer imagen de revit a excel através de visual studio

$
0
0

Se puede extraer imagen de revit a excel através de visual studio?

Re: Connect automatically Power BI to Revit to create project dashboards.

$
0
0

Thank you, Jeremy. I was only really kidding. I didn't mean to imply you had influence. 

 

Thanks as always for your contribution and insight. 

 

Re: External Command Initialization issue

$
0
0

I never ever type that function signature.

 

I always let Visual Studio build it for me automatically.

 

It can be inferred and automatically generated from the IExternalCommand interface.

 

Just right-click on IExternalCommand and select 'implement interface' in the context menu.

 

 

Re: Connect automatically Power BI to Revit to create project dashboards.

$
0
0

:-)

 

My pleasure entirely.

 

Thank you for your appreciation!

 

Re: Modify PropertyLine

$
0
0

I'm sorry for the short description.

I try to explain my problem more detailed.

With the Revit API it is not possible to create PropertyLines. So I try to copy one existing PropertyLine and change the location.

But the PropertyLine location cannot be transferd in a LocationCurve.

So i tried to identify why I cannot transfer the location and with dynamo I recognized that the PropertyLine location can be tranferd in a CurveLocation only when I use the PropertyLines id while in active “sketching-mode”. And dynamo gives me 2 different ids for the PropertyLine. One in the “normal” Revit-mode and one in active “sketching-mode”.

And with the id from the “sketching-mode” I can change the PropertyLine location but with the id from the “normal” Revit-mode I cannot. And with the Revit API I only get the normal id.

Viewing all 67020 articles
Browse latest View live


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