コード例 #1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Program             program    = null;
            GH_ExtrusionAttributes attributes = null;
            bool isWorld  = false;
            int  segments = 0;

            if (!DA.GetData(0, ref program))
            {
                return;
            }
            if (!DA.GetData(1, ref attributes))
            {
                return;
            }
            if (!DA.GetData(2, ref isWorld))
            {
                return;
            }
            if (!DA.GetData(3, ref segments))
            {
                return;
            }

            if (_visualizer == null || _visualizer.Program != program.Value)
            {
                _visualizer = new ExtrusionVisualizer(program.Value, attributes.Value.BeadWidth, attributes.Value.LayerHeight, attributes.Value.ExtrusionZone.Distance, isWorld, segments);
            }

            _visualizer.Update();

            DA.SetDataList(0, _visualizer.ExtrudedContours);
        }
コード例 #2
0
    protected override void SolveInstance(IGH_DataAccess DA)
    {
        GH_Program             program    = null;
        GH_ExtrusionAttributes attributes = null;
        bool isWorld  = false;
        int  segments = 0;

        if (!DA.GetData(0, ref program))
        {
            return;
        }
        if (!DA.GetData(1, ref attributes))
        {
            return;
        }
        if (!DA.GetData(2, ref isWorld))
        {
            return;
        }
        if (!DA.GetData(3, ref segments))
        {
            return;
        }

        if (program?.Value is not Program p)
        {
            AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input program can't have custom code.");
            return;
        }

        if (_visualizer == null || _visualizer.Program != p)
        {
            _visualizer = new ExtrusionVisualizer(p, attributes.Value.BeadWidth, attributes.Value.LayerHeight, attributes.Value.ExtrusionZone.Distance, segments);
        }

        _visualizer.Update();

        DA.SetDataList(0, _visualizer.ExtrudedContours);
    }