Closed chuongmep closed 1 year ago
Hi @Amoursol , any new update for this , same when we create new union fitting .
TransactionManager.Instance.ForceCloseTransaction();
using Autodesk.Revit.DB.Transaction tran = new Autodesk.Revit.DB.Transaction(firstPipe.InternalElement.Document, "Create Union Fitting");
tran.Start();
Connector? c1 = firstPipe.InternalElement.GetConnectorCloset(secondPipe.InternalElement);
Connector? c2 = secondPipe.InternalElement.GetConnectorCloset(firstPipe.InternalElement);
ElementId unionFitting = firstPipe.InternalElement.Document.Create.NewUnionFitting(c2, c1).Id;
int idValue = unionFitting.IntegerValue;
tran.Commit();
in this case unionFitting allway return null.
@wangyangshi Are you aware of this, should we forward this issue to Revit API team or?
Sorry for the late reply, I will look into this today, check if it is a D4R issue or Revit API related.
I also posted a topic in forum to explain for this: https://forum.dynamobim.com/t/newunionfitting-allway-return-null-in-dynamo-revit/85939/1
Hi @chuongmep what is the function 'ToDynamoType'? I am trying to reproduce your issue, cannot find it in d4r codes?
Hi @wangyangshi it is ToDSType(True)
@chuongmep I reproduced this issue, what I found is: 1 the property Tap is null, 2 then in the function ToDSType, as it calles ElementWrapper.Wrap, for the null Element, it doesn't know which is the right wrap function should use, so throw the warn. Do you think the null is abnormal in 1 ? Or we should make the warn message clear, for example adding a check in the function ToDSType before calling wrap.
pipeInternalElement.PipeType.Tap is FamilySymbol in fact this wrapper exists.
@wangyangshi that is correct issue I want report, I have many methods is same problem now.
1 Tap is null is abnormal, we need to investigate why it is null? 2 tap is null is expected, we just need to improve the warn message? I am not very clear which one do you want, or both two?
if you care about is 1, I will contact with related Revit API owner to seek for reasons, I am not very clear about MEP related. if you care about is 2, we can do some improvement in d4r codes.
Hi @wangyangshi, I need confirm my issue for clear :
OK, thank you, I will post these to related API teams.
Hi @chuongmep what is the function 'GetConnectorCloset', I cannot find it in Revit API, we need to reproduce the NewUnionFitting issue, thank you again.
@wangyangshi I want provide for you some file to quick check : Rvt2022 : https://1drv.ms/u/s!AmKukXZ0HxiElqxoqongELn_BG4fEA?e=KckFGi Scripts : https://1drv.ms/u/s!AmKukXZ0HxiElqxpOrYfLWiHXxH-YA?e=dA7BEo
I see 2 links are both RVT files?
I see 2 links are both RVT files?
I updated, can help me try again ?
Yes, it is the DYN file now.
Hi @chuongmep I contacted with other MEP related teams, got the reply, template file has no Pipe Tap fitting by default. And user need to load the tap to the project, and then set it to pipe type, thus user can get the tap element
I haven't tried this yet, just wander do you miss these steps then return the null tap?
@wangyangshi, many thanks for @wangyangshi about tap, I resolved from my side, how about issue with create union fitting ?
@chuongmep the API NewUnionFitting calls RbsEditorUtils::insertUnion in Revit, in fact the union element is created, but in this function, there is a check, if union element type is no REPT_Union, it will return null. I use your RVT&DYN file to test, the union element type is REPT_Transition, so although union element created successfully, it still returns null.
@wangyangshi, it means is this is correct null with Revit API ?
Yes, I see those codes hasn't been changed for many years, I think this is by design. in the forum someone recommends using NewTransitionFitting, because your return element Type is REPT_Transition, from the function name I think this should be the suitable method for you, would you please have a try?
all these NewXXXFitting
methods check element type if match then return the element, if not match then return null, so you may need to use the corresponding function.
Thanks, @wangyangshi, this is clear with me now, thanks for your supported, maybe I need some trick to help user get it.
If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.
Dynamo version
2.12
Revit version
2022
Operating system
Windows 10
What did you do?
Create a ZeroTouch Return Tap Of Pipe,
Then :
Warning: Pipe.GetTap operation failed. The call is ambiguous between the following methods or properties: 'Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.RoofType, bool)' and 'Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.ScheduleSheetInstance, bool)'
What did you expect to see?
It will be work perfect
What did you see instead?
(Fill in here)