3D viewer custom inherited objects

Hi all, I recently started with Speckle and have built a Speckle kit for Civil3D (currently using v1). When I send native objects (like SpeckleLine) to Speckle, I’m able to see them in the 3D viewer. But when I create a new SpeckleObject inherited from a SpecklePolycurve, this object is not showed in the viewer. How can I tell the viewer to display the object?

This code defines the inherited object:

public class Alignment: SpecklePolycurve
    public Alignment()
    public Alignment(string alignmentName, 
        List<SpeckleObject> alignmentSegments, 
        SpeckleNumber startStation, 
        double startParam, 
        double endParam, 
        bool closed, 
        string applicationId = null, 
        Dictionary<string, object> properties = null)
        foreach (object segment in alignmentSegments)
            if (segment.GetType() != typeof(SpeckleLine) &&
                segment.GetType() != typeof(SpeckleArc) &&
                segment.GetType() != typeof(AlignmentSegmentSpiral))
                throw new ArgumentException("Only segments of type SpeckleLine, SpeckleArc or AlignmentSegmentSpiral are allowed.");
        this.StartStation = startStation;
        this.AlignmentName = alignmentName;
        this.Segments = alignmentSegments;
        this.Closed = closed;
        this.ApplicationId = applicationId;
        this.Properties = properties;
        this.Domain = new SpeckleInterval(startParam, endParam);

    public override string Type
            return nameof(Alignment);

    public string AlignmentName { get; set; }

    public SpeckleNumber StartStation { get; set; }

Hi @gleeuwdrent! Welcome to these parts.

First off, I’d like to point out that 2.0 has an official Civil3D integration :wink: I don’t think we support alignments yet - but I might be wrong and @clrkng can clue you in more on this one.

Second off, 1.0 is in LTS, so we don’t really support new features. But i’m curious and I’ll bite: can you send a link to an actual alignment object from a 1.0 server? I’m interested in the actual json output.

I suspect two possible things:

  • you’re not correctly defining the polycurve’s expected curve array.
  • not sure what the implications of you overriding the type property are.

A peek at an object should let me grok the situation better.

Hi @dimitrie, thanks for your reply. I’m aware of the official Civil3D integration in version 2.0, but because it’s not officially released I’m working now as a pilot with version 1.0.

This is a link to an alignment object on the 1.0 server: https://bim-test.datafusr.rhdhv.digital/api/streams/7m3P1otbW/objects

Thanks for the investigation in my question!

Okay, i think i got it! You’re overriding the type property in a non canonical way to 1.0. See this defintion of a model curve (also inherits from a polycurve):

public partial class ModelCurve : SpecklePolycurve, ISpeckleElement
    public override string Type { get => base.Type + "/" + "ModelCurve"; }
    // etc.

Try defining the type in the same way for your alignment class:

public class Alignment: SpecklePolycurve
    public override string Type { get => base.Type + "/" + nameof(Alignment); }

And, if it works, I want to see a screenshot to celebrate! If it doesn’t, well, we move on debugging…

Thanks a lot, this resolves the issue!

Alignments are now right exported and displayed in the 3D viewer:

1 Like