Esempio n. 1
0
    def get_prop(self):
        """Returns structural properties from layer (last child only)."""

        if self.depth == 2:

            return ""

        return ri.RhinoInput(self.last).get_prop()
Esempio n. 2
0
    def get_grp(self):
        """Returns group number from layer; -1 if not specified."""

        grp = -1

        if self.depth > 2:

            inp = ri.RhinoInput(self.path[2])

            grp = inp.get_no()

        return grp
Esempio n. 3
0
    def build_base(self):
        """Sets element attributes based on Guid name from Rhino."""

        # start- and endpoints of lines are nodes, but they do not need to have a point object associated to them
        # in this case, self.geo is None and the no, prop and name attributes stay as the default values set in the constructor
        if (self.geo):

            attr = ri.RhinoInput(rs.ObjectName(self.geo))

            self.no = attr.get_no()
            if (self.no != -1):
                self.strict_naming = True

            self.name = attr.get_name()
            self.prop = attr.get_prop()
Esempio n. 4
0
    def test_square_brackets_only(self):

        inp = ri.RhinoInput("[]")
        self.assertEqual(inp.get_no(), -1)
        self.assertEqual(inp.get_prop(), "")
        self.assertEqual(inp.get_name(), "")
Esempio n. 5
0
    def test_without_square_brackets(self):

        inp = ri.RhinoInput("gdiv 4 { some beam}")
        self.assertEqual(inp.get_no(), -1)
        self.assertEqual(inp.get_prop(), "gdiv 4")
        self.assertEqual(inp.get_name(), "some beam")
Esempio n. 6
0
    def test_all(self):

        inp = ri.RhinoInput(" 2  [ gdiv 4  ] { some beam}")
        self.assertEqual(inp.get_no(), 2)
        self.assertEqual(inp.get_prop(), "gdiv 4")
        self.assertEqual(inp.get_name(), "some beam")
Esempio n. 7
0
    def test_number_and_name(self):

        inp = ri.RhinoInput(" 2  { some beam}")
        self.assertEqual(inp.get_no(), 2)
        self.assertEqual(inp.get_prop(), "")
        self.assertEqual(inp.get_name(), "some beam")
Esempio n. 8
0
    def test_number_and_property(self):

        inp = ri.RhinoInput(" 2  [ncs 5]")
        self.assertEqual(inp.get_no(), 2)
        self.assertEqual(inp.get_prop(), "ncs 5")
        self.assertEqual(inp.get_name(), "")
Esempio n. 9
0
    def test_number_only_with_whitespace(self):

        inp = ri.RhinoInput(" 2  ")
        self.assertEqual(inp.get_no(), 2)
Esempio n. 10
0
    def test_number_only(self):

        inp = ri.RhinoInput("2")
        self.assertEqual(inp.get_no(), 2)
Esempio n. 11
0
    def test_has_number(self):

        inp = ri.RhinoInput("4")
        self.assertEqual(inp.has_number(), True)
Esempio n. 12
0
    def test_does_not_have_a_number(self):

        inp = ri.RhinoInput("4alma")
        self.assertEqual(inp.has_number(), False)
Esempio n. 13
0
    def test_get_between(self):

        inp = ri.RhinoInput("adf [alma]")
        self.assertEqual(inp.get_between("[", "]"), "alma")
Esempio n. 14
0
    def test_get_before(self):

        inp = ri.RhinoInput("adf [alma]")
        self.assertEqual(inp.get_before("[", "]"), "adf ")
Esempio n. 15
0
    def get_name(self):
        """Returns group name from layer (last child only)."""

        return ri.RhinoInput(self.last).get_name()