ConnectorManager is null when object has connectors.

ConnectorManager is null when object has connectors.

mhillis
Advocate Advocate
1,420 Views
3 Replies
Message 1 of 4

ConnectorManager is null when object has connectors.

mhillis
Advocate
Advocate

Good Moring everyone.

 

I've got a bit of a loopy issue that's frustrating me a little bit.  I've got an MEP Model, in this case, a mechanical object.  When I do the following..

 

Element e = myMechObject;

if (e is FamilyInstance)
{
   FamilyInstance fi = e as FamilyInstance;
   
   if (fi.MEPModel != null)
   {
      ConnectorSetIterator csi = fi.MEPModel.ConnectorManager.Connectors.ForwardIterator();

      //Do stuff with csi.
   }
}

I get a 'null' value for my ConnectorSetIterator.  Here's the thing, the object HAS connectors and the object is being loaded as far as I can see.  I've put a watch on fi.Name.Symbol and it shows as the mech object that I'm working with, however; I've also confirmed that the fi.MEPModel.ConnectorManager does return null on it's own.  It shouldn't though. 

 

Anyone have any idea what might be causing the ConnectorManager to be getting a null value?  I've attached a sample mech object that replicates this issue. 

Accepted solutions (1)
1,421 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Dear mhillis,

 

I also check this family and i also get same issue. But for alternate solution you can do like..

 

 

foreach(Connector con in (elm as FamilyInstance).MEPModel.ConnectorManager.Connectors.Cast<Connector>())
{
   / / Do your Stuff
}

 

 

Example1.png

Thanks

0 Likes
Message 3 of 4

mhillis
Advocate
Advocate

@BholaDev wrote:

Dear mhillis,

 

I also check this family and i also get same issue. But for alternate solution you can do like..

 

 

foreach(Connector con in (elm as FamilyInstance).MEPModel.ConnectorManager.Connectors.Cast<Connector>())
{
   / / Do your Stuff
}

 

 

Example1.png

Thanks


Bhola dev, thanks for the reply, however; tha doesn't appear to work.  As I mentioned in my first post, for some reason, the actual ConnectorManager of the object is returning 'null', so the example you posted to try won't work I feel.

 

I did try it to no avail. 

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

Dear mhillis,

 

 

 

I am getting connector using

 

foreach(Connector con in (elm as FamilyInstance).MEPModel.ConnectorManager.Connectors.Cast<Connector>())
{
   / / Do your Stuff
}

 

Please see attached files.

0 Likes