Example #1
0
        public override void Draw()
        {
            if (CheckInputs())
            {
                DataTree treeIn = InPortData[0].Object as DataTree;
                if (treeIn != null)
                {
                    //Hashtable parameterMap = InPortData[1].Object as Hashtable;

                    SortedDictionary <string, object> parameterMap = InPortData[1].Object as SortedDictionary <string, object>;

                    if (parameterMap != null)
                    {
                        ProcessState(treeIn.Trunk, parameterMap);
                    }
                }
            }

            base.Draw();
        }
Example #2
0
        public override void Draw()
        {
            //skip the first port data because it's the family instances
            for (int i = 1; i < InPortData.Count; i++)
            {
                PortData pd = InPortData[i];
                //parameter value keys are the tooltip - the name
                //of the parameter
                //set the objects on the parameter map
                parameterMap[pd.ToolTipString] = pd.Object;

                DataTree familyInstTree = InPortData[0].Object as DataTree;
                DataTree doubleTree     = pd.Object as DataTree;

                if (familyInstTree != null && doubleTree != null)
                {
                    //get the parameter represented by the port data
                    Process(familyInstTree.Trunk, doubleTree.Trunk, pd.ToolTipString);
                }
            }
        }
Example #3
0
        void paramMapButt_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (CheckInputs())
            {
                CleanupOldPorts();

                DataTree treeIn = InPortData[0].Object as DataTree;
                if (treeIn != null)
                {
                    object o = treeIn.Trunk.FindFirst();

                    if (o != null)
                    {
                        FamilyInstance fi = o as FamilyInstance;
                        if (fi != null)
                        {
                            MapPorts(fi);
                        }
                    }
                }
            }
        }
Example #4
0
        public override void Draw()
        {
            if (CheckInputs())
            {
                DataTree treeA = InPortData[0].Object as DataTree;
                DataTree treeB = InPortData[1].Object as DataTree;

                if (treeB != null && treeB.Trunk.Leaves.Count > 0)
                {
                    //we're only using the first point in the tree right now.
                    if (treeB.Trunk.Leaves.Count > 0)
                    {
                        ReferencePoint pt = treeB.Trunk.Leaves[0] as ReferencePoint;


                        if (treeA != null && pt != null)
                        {
                            Process(treeA.Trunk, this.Tree.Trunk);
                        }
                    }
                }
            }
        }
Example #5
0
        void paramMapButt_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            //read from the state objects
            if (CheckInputs())
            {
                CleanupOldPorts();

                DataTree treeIn = InPortData[0].Object as DataTree;
                if (treeIn != null)
                {
                    if (treeIn.Trunk.Branches.Count > 0)
                    {
                        if (treeIn.Trunk.Branches[0].Leaves.Count > 0)
                        {
                            FamilyInstance fi = treeIn.Trunk.Branches[0].Leaves[0] as FamilyInstance;
                            if (fi != null)
                            {
                                MapPorts(fi);
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        /// dynElement constructor for use by workbench in creating dynElements
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="nickName"></param>
        public dynElement()
        {
            InitializeComponent();
            //System.Uri resourceLocater = new System.Uri("/DynamoElements;component/dynElement.xaml", UriKind.Relative);
            //System.Uri resourceLocater = new System.Uri("/dynElement.xaml", UriKind.Relative);
            //System.Windows.Application.LoadComponent(this, resourceLocater);

            //set the main grid's data context to
            //this element
            nickNameBlock.DataContext = this;

            inPorts = new List<dynPort>();
            inPortData = new List<PortData>();
            outPortData = new List<PortData>();
            outPorts = new List<dynPort>();
            statePorts = new List<dynPort>();
            statePortData = new List<PortData>();
            elements = new ElementArray();
            dataTree = new DataTree();
            stateSetter = new SetStateDelegate(SetState);
            Dispatcher.Invoke(stateSetter, System.Windows.Threading.DispatcherPriority.Background, new object[] {this, ElementState.DEAD });

            ElementNameAttribute elNameAttrib = this.GetType().GetCustomAttributes(typeof(ElementNameAttribute), true)[0] as ElementNameAttribute;
            if (elNameAttrib != null)
            {
                NickName = elNameAttrib.ElementName;
            }

            //set the z index to 2
            Canvas.SetZIndex(this, 1);

            //generate a guid for the component
            dynElementReadyToBuild += new dynElementReadyToBuildHandler(Build);
        }