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

Re: CreateReferenceInLink throwing exception

$
0
0

Dear Jeremy,

Thanks for your interest. I tried to attach two files (about 7 MB in total) but after clicking to "Post" button message is not submitted. I suspect that reason is file size. So I uploaded botfh files in one Zip file on WeTransfer. You can download it here

 

In downloaded file (Sample.zip) you will find two files Host1.rvt and Link1.rvt. Please open Host1.rvt. In that file Link1.rvt is linked.

  • Please make view "Wall in host file" active. In that view one conduit and one wall (modelled in Host1.rvt) is shown.
  • Now run macro: TestFindNearest which is included in Host1.rvt.
  • Revit should respond with TaskDialog showing 1.99999 what is projected distance between specific point (on conduit) and wall. That is expected behaviour.
  • Now activate view "Wall in linked file". You will see the same -- Wall and conduit. The difference is that wall  shown in this view is modelled in Link1.rvt, (conduit exists only in Host1.rvt). Wall modelled in Host1.rvt is hidden in this view similarly as it is complete Link1.rvt hidden in "Wall in host file" view.
  • Run the same macro again.
  • Revit responds with exception thrown in statement (please see source code) where I am trying to call CreateReferenceInLink.

If you analyse the code, you will find out that ReferenceIntersector in second case returns reference to some geometry in linked file. After that I am trying to check if returned reference is pointing to host or linked file. If it is in linked file I slightly modify the procedure how to get appropriate face. I wrote that procedure after analysing some similar (but not the same) samples on net, so it is possible that the procedure is wrong.

 

Actually, my ultimate wish is to get the same result -- distance between point and nearest face of wall now modelled in linked file.

 

(Wall in Link1.rvt is not modelled on the same position as in Host1.rvt. That is intentionally. O moved origin of Link1. rvt in Host1. rvt accordingly, so that result will be the same -- 1.99999 only if procedure of retrieving distance is taking into account also relative position of linked file in host file, but up to now, due to the problem with retrieving geometry in linked file,  I didn't get so far to check also that part.)

 

Kind regards,

Žarko


Re: How to Get Relationship between Floor and Slab Edge

$
0
0

Hi, 

I also run to the same issue and i didn't find an answer. but as a work round, I would say:

  1. get the bounding box of the slab edge
  2. Get all elements within this Bounding box of type floor
  3. start a transaction
  4. loop through the floors
  5. delete a floor
  6. check the deleted elements contains the slab edge element ID
  7. if it contains, then you got the floor.
  8. break the loop
  9. Rollback the transaction
var slabedgeboundingbox = myslabedge.get_BoundingBox(null);
					BoundingBoxIntersectsFilter binsfilter = new BoundingBoxIntersectsFilter(new Outline(slabedgeboundingbox.Min, slabedgeboundingbox.Max));
					var floorsfilcol = new FilteredElementCollector(doc).WherePasses(binsfilter).OfClass(typeof(Floor)).Cast<Floor>();
					Floor myfloor = null;
					using (Transaction t = new Transaction(doc, "Find Slab Edge"))
					{
						t.Start();


						foreach (var floor in floorsfilcol)
						{
							var deletedids = UT_Rvt.m_doc.Delete(floor.Id);
							if(deletedids.Any(o=>o == myslabedge.Id))
							{
								myfloor = floor;
								break;
							}
						}


						t.RollBack();
					}

hope that helps

Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

I have had a quick look. it seems there is something wrong with the revit file, I believe it needs Auditing. for example if you collected all the phases in this project you would find you have 19 phases but actually through the UI you only have new construction and existing.

I tried auditing the file but still i get 19 phases... I would say you need to delete all the phases through the api and start again...

Re: HOW TO ADD TAG TO DETAIL ITEM FAMILY?

$
0
0

Hi,

Detailed Tag Category is located under

BuiltInCategory.OST_DetailComponents

hope that helps

How to remove security dialog when loading signed add-in?

$
0
0

When a new add-in loads into Revit you get a Security warning dialog asking the user to trust the add-in.  While this makes sense, especially for unsigned add-ins, our signed add-in still generates this dialog.

According to the Revit API documentation:
https://help.autodesk.com/view/RVT/2020/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Introduction_Add_In_Integration_Digitally_Signing_Your_Revit_Add_in_Digitally_Signing_Your_App_html

 

"Once the DLL is signed with an authorized certification, Revit will no longer pop up a security warning dialog upon loading your add-in."


We signed our add-in dll with a number of code signing cert providers but a security dialog always is displayed.  We kept on buying more expensive code signing certificates thinking that this might be a matter that the root certificates of the CA authority may not be trusted.

First tried a trial Ascertia code signing cert.
Next a GlobalSign standard code signing cert protected by a hardware token.

Lastly, a DigiCert EV code signing cert which is also protected by a hardware token.

All produce the security dialog.  I don't think there is a more trusted certificate than an EV one.

Is there something else I must do to get this security dialog to not show?

 

I have researched the forums and there is an old thread about code signing Revit add-ins that seems to talk about this:
https://forums.autodesk.com/t5/revit-api-forum/code-signing-of-revit-addins/td-p/5981560

 

It this thread Jeremy Tammik reproduced a copy of pre-release documentation that seems to indicate that I need to install a certificate in the Trusted Publishers store.  I have experimented with this and it seems if I add the code signing certificate itself to the Trusted Publishers store, Revit does indeed not show the security dialog on loading the add-in.

But is this right?  I need to use the "code signing" certificate?  The root certificate does not work?
I have some resistance to this as I want my add-in installer to not require administrator privileges.

Also, I could not find any mention of this in "official" Autodesk documentation (except for making your own certificate for testing).  I don't want to apply a fix that will just break with the next update of Revit.

I have also tried some of the registry modifications from this forum thread.
https://forums.autodesk.com/t5/revit-api-forum/security-prompt-for-unsigned-add-ins/td-p/7299954

They did not work for me.  Maybe because the add-in is signed.

What do other add-in developers do to get rid of this dialog?

Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

Intersting.  No idea where the extra phases came from.  Yes seems like a corrupt Revit file.  I tried auditing as well, without success. 

 

I tried deleting the extra phases through the API (good thought!), but Revit throws an exception when trying to delete one of them.  "Autodesk.Revit.Exceptions.InternalException: A managed exception was thrown by Revit or by one of its external applications".  Further suggests corruption.

 

Thanks for looking.

Re: GeometryObject Face of HostFace elem in link. file hosts act. file Fam.Insta

$
0
0

This code is exactly what I needed, your a true Genius Mustafa.

Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

You can delete all the phases, except the ones that are used for

  • CreatedPhase of Elements.
  • DemolishedPhase of Elements.
  • Phase of Views

Only the phase with Id 86961 can't be deleted.  


Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

Thanks.  But it's actually the phases with ids 7164607 and 7198010 that throw the error when I try to delete.   

 

If I delete all phases except 12589, 86961, 7164607, and 7198010, I still see the same issue with the GetPhaseStatus method.

Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

well how about try creating new 2 phases something like existing_new, Construction_New, assign all the elements to the newly created phases, then delete the others via API. 

Re: GeometryObject Face of HostFace elem in link. file hosts act. file Fam.Insta

Re: How to Get Relationship between Floor and Slab Edge

$
0
0

I am happy that there is a simple solution, but any such workaround shifts the day an actual solution for hidden element-relations is provided. While such things work when you have write access, they fail in many relevant situations (e.g. linked documents, worksharing), unfortunately. This restriction may be completely fine for the original posters context though.

 

I am just writing this to express how annoying it is that the temporary transaction trick still has to be used in 2020 ;-).

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

Machine Learning data format

$
0
0

Hi,

I would like to create a room furniture layout generating ML model. I have a good idea how this could be achieved using images of room plans. However, if it was to be integrated into a Revit add-in, I don't think there is a way of taking a 'screenshot' of particular room's plan view (please, correct me, if I'm wrong here). Besides, it should be even better to directly access the room geometry data.

 

However, I can't get my head round as to how to collect this information. For instance - how to capture the shape of the room? It would be tempting to use boundary lines, but I'd have to normalize them to (0,0). In that case, what happens when the same room is the other way round, etc.

 

Does anyone have any experiences they could share within this field?

 

I am happy to create a website for the created dataset to share with the community.

 

Thanks

Re: Tag Width/Height or Accurate BoundingBox of IndependentTag

$
0
0

I'm getting the same result, the bounding box is including an imaginary leader even if the leader is off. This issue only seems to occur on horizontally modeled system families.

If you hover over the tag without selecting it, Revit highlights an imaginary line to the tagged element. This imaginary line is included in the bounding box.

I wish I knew how to prevent this.

Kind Regards

David

 

 

 


Re: How to Get Relationship between Floor and Slab Edge

$
0
0

That is a perfectly valid complaint.

 

Unfortunately, the development team and program managers will not see it here in the forum.

 

If you can reformulate that as an API wish list item in the Revit Idea Station, you may be able to gather a huge number of votes for it.

 

That would be something that the development team and program managers would see and care about.

 

Re: Machine Learning data format

$
0
0

That's a very interesting topic indeed.

 

Sure you can take a screen snapshot of a floor plan if you like. Just determine the Windows device coordinates of the area of interest and grab the pixels from there. The UIView class provides functionality to translate Revit model coordinates to screen pixel device coordinates.

 

You can also easily access the room boundary curves and furniture instance geometry data. I implemented that exact aspect years ago for my simplified 2D room editor: https://github.com/jeremytammik/RoomEditorApp

 

You can easily normalise to zero. In fact, the GeoSnoop tool included in the room editor shows how easily that can be done.

 

Looking forward to your further thoughts, ideas, and implementation.

 

Re: Machine Learning data format

$
0
0

 

Sure you can take a screen snapshot of a floor plan if you like. Just determine the Windows device coordinates of the area of interest and grab the pixels from there. The UIView class provides functionality to translate Revit model coordinates to screen pixel device coordinates.

 


Thanks for a quick response. I did not know about the above. That could be the solution I was looking for, as it's reasonably well documented how to train from pixel data. I would just have to hand annotate (label) door, window and furniture location and types to create a dataset.

 

 

You can also easily access the room boundary curves and furniture instance geometry data. I implemented that exact aspect years ago for my simplified 2D room editor: https://github.com/jeremytammik/RoomEditorApp

 

You can easily normalise to zero. In fact, the GeoSnoop tool included in the room editor shows how easily that can be done.

 


I know how to achieve the above (more or less; and NOT to your level of programming), but I don't have any good idea how to utilize it within ML workflow. But it might be a better, more sophisticated way of capturing data for the future.

Regards,

Karol

Re: Revit crashes on debug mode

$
0
0
 

All my settings are correct in my Visual Studio file. I solved the issue by un-installing a 3rd party plugin. 

So 3rd plugin parties do seem to have an issue when running the Revit.exe file in debug mode from within VS. I will mark my issue as solved 

Revit Event hander when activeUIDocument changed to another activeUIdocument

$
0
0

Hello, I want an event handler that is invoked when an active document is toggled between two created documents. Is there any event handler regarding this?? Please help...

Viewing all 66692 articles
Browse latest View live


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