Conduit API

Conduit API

donquevedor
Participant Participant
417 Views
3 Replies
Message 1 of 4

Conduit API

donquevedor
Participant
Participant

I am trying to get the conduit type of the last used conduit , but it doesnt work

 

ConduitType activeConduitType = null;

 

ElementId defaultTypeId =
doc.GetDefaultElementTypeId(ElementTypeGroup.ConduitType);

if (defaultTypeId != ElementId.InvalidElementId)
{
activeConduitType = doc.GetElement(defaultTypeId) as ConduitType;
}

 

if (activeConduitType == null)
{
activeConduitType = new FilteredElementCollector(doc)
.OfClass(typeof(ConduitType))
.Cast<ConduitType>()
.FirstOrDefault();
}

 

var conduitSizeSettings = ConduitSizeSettings.GetConduitSizeSettings(doc);

var standardName = activeConduitType.get_Parameter(BuiltInParameter.CONDUIT_STANDARD_TYPE_PARAM).AsValueString();

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

longt61
Advocate
Advocate

Could you clarify what you meant by " last use" and add more context?

Is that the conduit type from your last command, is it the conduit type from the last method you call, or is it the conduit type from the last loop?

I don't see any problem with the code, so it is hard to pin point the issue without knowing what you were trying to do.

0 Likes
Message 3 of 4

ricaun
Advisor
Advisor

I believe the last use means when the user use the command to create the Conduit and select a type, if you want to know what type the user selected don't think there are a way to know using the API.

 

I definaly would love that to know the type and size the user selected when using the Conduit or other types, no API support for this kind of UI information 😒

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 4 of 4

rcrdzmmrmnn
Advocate
Advocate

Weird, that snippet of code works fine for me, I've tested using conduit command, changing type and then placing conduit, tested using "create similar" and in both cases it works... So, maybe I misunderstood the question.. Either way, even if this is not what you are looking for, you can always count on events like DocumentChanged or even IUpdater if appropriate. Maybe a bit overkill but gets the job done. So you could create a static property and the event/trigger updates its value whenever user creates a conduit.

0 Likes