TransmissionData causing error for Local Revit file.

TransmissionData causing error for Local Revit file.

Anonymous
Not applicable
624 Views
3 Replies
Message 1 of 4

TransmissionData causing error for Local Revit file.

Anonymous
Not applicable

Hi Everyone,

 

I tried to using TransmissionData to unload all the Revit link before open it. But it seems like when I apply it for a Local Revit file, it make the local file disconnected with the central file and Revit ask to save it as Central file.

So if anyone have some experience with this issue, please help me :).

Thank you so much

Capture.PNG

 

 

 BasicFileInfo fileInfo = BasicFileInfo.Extract(s);
                if(fileInfo.IsCentral==false)
                {
                    ModelPath mp = ModelPathUtils.ConvertUserVisiblePathToModelPath(@s);

                    TransmissionData transmis = TransmissionData.ReadTransmissionData(mp);

                    ICollection<ElementId> linkID = transmis.GetAllExternalFileReferenceIds();

                    foreach (ElementId elementId in linkID)
                    {
                        ExternalFileReference extRef = transmis.GetLastSavedReferenceData(elementId);

                        ModelPath linkpath = extRef.GetPath();

                        if (extRef.ExternalFileReferenceType == ExternalFileReferenceType.RevitLink
                            && ModelPathUtils.ConvertModelPathToUserVisiblePath(linkpath).ToString().Contains(Path.GetFileNameWithoutExtension(s)) == false
                            )

                        {
                            //TaskDialog.Show("Revit link", ModelPathUtils.ConvertModelPathToUserVisiblePath(linkpath).ToString()); 
                            transmis.SetDesiredReferenceData(elementId, linkpath, extRef.PathType, false);

                        }

                    }
                    transmis.IsTransmitted = true;
                    TransmissionData.WriteTransmissionData(mp, transmis);

 

0 Likes
625 Views
3 Replies
Replies (3)
Message 2 of 4

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous,

If you open a transmitted Revit model that is workshared, you are prompted to save the model locally or to Central.

To achieve this you can use TransmittedModelOption

TransmittedModelOptions Enumeration

You can use any one of the below modeloptions

TransmittedModelOptions TMO = TransmittedModelOptions.SaveAsNewCentral;
                TransmittedModelOptions TMO = TransmittedModelOptions.CancelOperation;
                TransmittedModelOptions TMO = TransmittedModelOptions.KeepAsTransmitted;

 

 

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 4

Anonymous
Not applicable

Hi Naveen,

 

Thank you for your suggestion. But I still don't know how to implement TransmittedModelOptions enum into my code. Could you please help me with more details how to implement this? 

 

Thank you so much Smiley Very Happy

 

Best Regards,

 

Cherry Truong

Message 4 of 4

Anonymous
Not applicable

I have the same problem. Can anyone help?

0 Likes