The model module is the recommended API for read access to members, ends, materials, holes, bolts, and welds. Each of those categories are represented by a single type, model.object, and the objects are accessed via indexes. This module provides syntactic sugar for accessing those objects.
Examples: mo_m(1) #model.object for member 1 mo_e(1,0) #model.object for member 1's left end mo_le(1) #model.object for member 1's left end mo_re(1) #model.object for member 1's right end mo_mt(1,0) #model.object for first material on member 1 mo_h(1,0,0) #model.object for first hole on mo_mt(1,0) mo_b(1,0) #model.object for first bolt on member 1 mo_w(1,0) #model.object for first weld on member 1
SDS2 has multiple type representations for members, materials, holes, etc. This module provides functions to convert between them (see to_mo, gen_mt, hlist, mb) and functions to create model.objects from generic objects. This module uses a naming convention that drops the 'mo_' prefix for creating model.objects from generic functions. Examples: m(1) m(mo_m(1)) m(member.Memer(1)) m(MemberBase.GetMemberLink(1,False,False) mt(1,0) mt(mt(1,0)) mt(member.Member(1).Material(0))
Creating model.object members can be surprisingly (and maybe alarmingly) easy. assert m(1) == m(mt(1,0))
This module also provides access to member views and components which are not model.object types. vs_on_m(1) #vies on member 1 v(1,0) #first view on member 1 cs_on_m(1) #components on member 1 c(1,0) #first component on member 1
def sds2.obj.aabb_m | ( | args | ) |
Axis aligned bounding box containing member head and all members in tail trb = head.bound_trb blf = head.bound_blf head_aabb = (blf.x, blf.y, trb.z, trb.x, trb.y, blf.z) return (head_aabb if len(tail) == 0 else aabb_union(head_aabb, aabb_m(tail[0], *tail[1:])) )
def sds2.obj.aabb_pt | ( | args | ) |
Axis aligned bounding box containing point head and points in tail head_aabb = xyz(pt(head)) * 2 return (head_aabb if len(tail) == 0 else aabb_union(head_aabb, aabb_pt(tail[0], *tail[1:]))
def sds2.obj.aabb_union | ( | args | ) |
Union of two axis aligned bounding boxes return (min(min_x_a, min_x_b) , min(min_y_a, min_y_b) , min(min_z_a, min_z_b) , max(max_x_a, max_x_b) , max(max_y_a, max_y_b) , max(max_z_a, max_z_b) )
def sds2.obj.all_enum_families | ( | args | ) |
Return list of all model module family names (i.e. names of model module enumerated types) return set( (getattr(model,a).family for a in dir(model) if hasattr(getattr(model, a), 'family') ) )
def sds2.obj.all_gs | ( | args | ) |
return GroupMember.GetGroups()
def sds2.obj.all_ms | ( | args | ) |
all members in the job return model.members(0)
def sds2.obj.angle | ( | args | ) |
return p3d.Angle(pt(u), pt(v))
def sds2.obj.are_disjoint_aabbs | ( | args | ) |
Are the two axis aligned bounding boxes disjoint return (min_x_a > max_x_b or min_y_a > max_y_b or min_z_a > max_z_b or min_x_b > max_x_a or min_y_b > max_y_a or min_z_b > max_z_a )
def sds2.obj.are_overlapping_aabbs | ( | args | ) |
Do the two axis aligned bounding boxes overlap return not are_disjoint_aabbs(a, b)
def sds2.obj.b | ( | args | ) |
return (mo_b(hn(args[0]), args[1]) if len(args) == 2 else args[0] if is_mo_and_b(args[0]) else b(*args[0]) ) Example: assert (mo_b(59, 0) == b(member.Member(59),0) and mo_b(59,0) == b((59,0)) and mo_b(59,0) == b(mo_b(59,0)) )
def sds2.obj.b2g | ( | args | ) |
Bolt to global return mo_ref_xform(b) * mo_ref_xform(m(b))
def sds2.obj.b_end_conn_ij | ( | args | ) |
return b.conn_mem_idx, b.conn_mem_end
def sds2.obj.bisector | ( | args | ) |
return p3d.Bisector(pt(u), pt(v))
def sds2.obj.bolts_mo_m | ( | args | ) |
return mo_m.bolts
def sds2.obj.c | ( | args | ) |
return((lambda i, j: cs_on_mn(hn(i), j))(*args) if len(args) > 1 else args[0] if is_c(o) else c(*args[0]) )
def sds2.obj.conn_c_to_mo_e | ( | args | ) |
Return model.object end corresponding to connection component return (mo_le(conn_c.member_number) if is_c_ref_pt_at_origin(conn_c) else mo_re(conn_c.member_number) )
def sds2.obj.cross | ( | args | ) |
return p3d.Cross(pt(u), pt(v))
def sds2.obj.cs_on_m | ( | args | ) |
return cs_on_mn(hn(generic_member))
def sds2.obj.cs_on_mn | ( | args | ) |
return Component.GetComponentsOnMember(member_number)
def sds2.obj.default_except_handler | ( | args | ) |
traceback_warning_list(str(e))
def sds2.obj.default_repr | ( | args | ) |
return (mo_repr(o) if is_mo(o) else '%s(%r)' % (o.__class__.__name__, o.__dict__) )
def sds2.obj.dist | ( | args | ) |
return p3d.Distance(pt(p), pt(q))
def sds2.obj.dot | ( | args | ) |
return p3d.Dot(pt(u), pt(v))
def sds2.obj.dsel | ( | args | ) |
Deselect args args = selected() if args is None else list(args) return (model.Deselect(filter(is_mo, args)) + Component.Deselect(filter(is_c, args)) )
def sds2.obj.e | ( | args | ) |
return (mo_e(hn(args[0]), args[1]) if len(args) > 1 else args[0] if is_mo_and_e(args[0]) else e(*args[0]) ) Example: assert (mo_le(1) == e(member.Member(1), 0) and mo_le(1) == e((1,0)) and mo_le(1) == e(mo_le(1)) )
def sds2.obj.end_conn_ij | ( | args | ) |
return b_end_conn_ij(o) if is_mo_and_b(o) else mt_end_conn_ij(o)
def sds2.obj.ends_mo_m | ( | args | ) |
return mo_m.ends
def sds2.obj.enum_mem_types | ( | args | ) |
return enums_of_family('MemberType')
def sds2.obj.enum_mt_types | ( | args | ) |
return enums_of_family('MaterialType')
def sds2.obj.enums_of_family | ( | args | ) |
return (getattr(model,a) for a in dir(model) if hasattr(getattr(model,a), 'family') and getattr(model,a).family == family ) See all_enum_families() for available families Example: return enums_of_family('MemberType') #i.e. enum_mem_types()
def sds2.obj.g | ( | args | ) |
return (all_gs() if indexable_gs is None else indexable_gs)[idx]
def sds2.obj.gen_mt | ( | args | ) |
return mo_mt_to_gen_mt(mt(*args))
def sds2.obj.GetXYZT | ( | arg1 | ) |
C++ signature : boost::python::tuple GetXYZT(Xform)
def sds2.obj.h | ( | args | ) |
return (mo_h(**(dict(zip( ('m', 'mt', 'h') , list(ij_mo_mt(mt(*args[:-1]))) + [args[-1]] )))) if len(args) > 1 else args[0] if is_mo_and_h(args[0]) else args[0].modelobject() if is_hlist(args[0]) else h(*args[0]) ) Example: assert (mo_h(1,0,0) == h(member.Member(1),0,0) and mo_h(1,0,0) == h((1,0),0) and mo_h(1,0,0) == h((1,0,0)) and mo_h(1,0,0) == h(mo_h(1,0,0)) and mo_h(1,0,0) == h(member.Member(1).Material(0).HoleList()[0]) and mo_h(1,0,0) == h(member.Member(1).Material(0), 0) )
def sds2.obj.h2g | ( | args | ) |
Hole to global return h_2_mt(h) * mt2g(mo_to_mo_mt(h))
def sds2.obj.h2mt | ( | args | ) |
Hole to material return h2rot(h) * h2mt_sans_rot(h)
def sds2.obj.h2mt_sans_rot | ( | args | ) |
Hole to material sans hole rotation m = mo_ref_xform(h) m.SetTranslation(pt(h.ref_loc)) return m
def sds2.obj.h2rot | ( | args | ) |
Hole to hold rotation return x3d.Transform3D().RotateZ(h.rot)
def sds2.obj.hlist | ( | args | ) |
return mo_h_to_hlist(h(*args)) Example: assert (member.Member(1).Material(0).HoleList()[0].modelobject() == hlist((1,0,0)).modelobject() and h(1,0,0) == hlist((1,0,0)).modelobject() )
def sds2.obj.holes_mo_mt | ( | args | ) |
return mo_mt.holes
def sds2.obj.host_number | ( | args | ) |
Extract a member number return (o if isinstance(o, int) else host_number_mo(o) if is_mo(o) else o.number if hasattr(o, 'number') else o.MemberNumber if hasattr(o, 'MemberNumber') else o.member_number if hasattr(o, 'member_number') else host_number(o.HostMember()) if hasattr(o, 'HostMember') else host_number_mo(o.modelobject()) if hasattr(o, 'modelobject') else None ) Example: assert (1 == host_number(1) and 1 == host_number(mo_m(1)) and 1 == host_number(member.Member(1).Material(0)) and 1 == host_number(mb(1)) )
def sds2.obj.host_number_mo | ( | args | ) |
Return the member number of the member containing x return x._as_tuple[0]
def sds2.obj.host_number_mo_m | ( | args | ) |
return x.number
def sds2.obj.ij_mo_b | ( | args | ) |
return indices_mo(b, 0, 4) Example: assert 59,0 == ij_mo_b(mo_b(59,0))
def sds2.obj.ij_mo_e | ( | args | ) |
return indices_mo(e, 0, 1) Example: assert 1,0 == ij_mo_e(mo_le(1))
def sds2.obj.ij_mo_mt | ( | args | ) |
return indices_mo(mt, 0, 2) Example: assert list(ij_mo_mt(mo_mt(1,0))) == list(indices_mo(mo_mt(1,0), 0, 2))
def sds2.obj.ij_mo_w | ( | args | ) |
return indices_mo(w, 0, 5) Example: assert 1,0 == ij_mo_w(mo_w(1,0))
def sds2.obj.ijk_mo_h | ( | args | ) |
return indices_mo(h, 0, 2, 3) Example: assert [1,0,0] == list(ijk_mo_h(mo_h(1,0,0)))
def sds2.obj.indexof_mo | ( | args | ) |
return next((i for i in reversed(mo._as_tuple) if i!=-1), None) Example: assert (1 == indexof_mo(mo_m(1)) and 0 == indexof_mo(mo_mt(1,0)) and 2 == indexof_mo(mo_h(1,0,2)) )
def sds2.obj.indices_indexable | ( | args | ) |
return (indexable[i] for i in indices) Example: assert 3,4 == indices_indexable((2, 3, 4, 5), 1, 2)
def sds2.obj.indices_mo | ( | args | ) |
return indices_indexable(mo._as_tuple, *ns) Example: assert 1,0 == indices_mo(mo_mt(1,0), 0, 2)
def sds2.obj.interpolate | ( | args | ) |
return p3d.Interpolate(pt(p), pt(q), s)
def sds2.obj.inv | ( | args | ) |
Return the inverse of a matrix return xform(matrix_concept).Inverse()
def sds2.obj.is_c | ( | args | ) |
return isinstance(o, Component.Component)
def sds2.obj.is_c_ref_pt_at_origin | ( | args | ) |
return c.ref_point.EpsilonEquals(pt(), accy)
def sds2.obj.is_conn_c | ( | args | ) |
Return True iff c is a connection component (i.e. a builtin component) return type(c) == Component.Component
def sds2.obj.is_created_by | ( | args | ) |
return is_created_by_bytes(obj, creator.uuid.bytes)
def sds2.obj.is_created_by_bytes | ( | args | ) |
return solids_creator_uuid_buffer(obj) == creator_uuid_bytes
def sds2.obj.is_g | ( | args | ) |
return isinstance(o, GroupMember.Group)
def sds2.obj.is_gen_mt | ( | args | ) |
is_gen_mt(args)
def sds2.obj.is_hlist | ( | args | ) |
is_hlist(args)
def sds2.obj.is_m_active | ( | args | ) |
return optional_m(m, silently_ignore_exception) is not None
def sds2.obj.is_m_pym | ( | args | ) |
return is_mo_m_pym(m(generic_member))
def sds2.obj.is_mb | ( | args | ) |
return isinstance(o, MemberBase.MemberBase)
def sds2.obj.is_mn_active | ( | args | ) |
return optional_mo_m(mn, silently_ignore_exception) is not None
def sds2.obj.is_mo | ( | args | ) |
return isinstance(o, mo)
def sds2.obj.is_mo_and | ( | args | ) |
return is_mo(o) and pred(o)
def sds2.obj.is_mo_and_b | ( | args | ) |
return is_mo_and(o, is_mo_b)
def sds2.obj.is_mo_and_e | ( | args | ) |
return is_mo_and(o, is_mo_e)
def sds2.obj.is_mo_and_h | ( | args | ) |
return is_mo_and(o, is_mo_h)
def sds2.obj.is_mo_and_le | ( | args | ) |
return is_mo_and(o, is_mo_le)
def sds2.obj.is_mo_and_m | ( | args | ) |
return is_mo_and(o, is_mo_m)
def sds2.obj.is_mo_and_mt | ( | args | ) |
return is_mo_and(o, is_mo_mt)
def sds2.obj.is_mo_and_re | ( | args | ) |
return is_mo_and(o, is_mo_re)
def sds2.obj.is_mo_and_w | ( | args | ) |
return is_mo_and(o, is_mo_w)
def sds2.obj.is_mo_le | ( | args | ) |
e = mo._as_tuple[1] return e > -1 and e % 2 == 0
def sds2.obj.is_mo_m_pym | ( | args | ) |
return mo_m.memt == model.Custom
def sds2.obj.is_mo_re | ( | args | ) |
e = mo._as_tuple[1] return e > -1 and e % 2 == 1
def sds2.obj.is_parallel | ( | args | ) |
return p3d.IsParallel(pt(u), pt(v))
def sds2.obj.is_part_of_end_connection | ( | args | ) |
return end_conn_id(obj) == ij_mo_e(e)
def sds2.obj.is_perp | ( | args | ) |
return p3d.IsPerpendicular(pt(u), pt(v))
def sds2.obj.is_pyc | ( | args | ) |
Return True iff o is a python componet return is_c(o) and not is_conn_c(o)
def sds2.obj.is_v | ( | args | ) |
return isinstance(o, view.MemberViewTuple)
def sds2.obj.IsBolt | ( | modelobject | ) |
Return True iff the modelobject represents a bolt. Example: LocateSingle('Locate bolt', IsBolt) C++ signature : bool IsBolt(modelobject)
def sds2.obj.IsEnd | ( | modelobject | ) |
Return True iff the modelobject represents an end. Example: LocateSingle('Locate end', IsEnd) C++ signature : bool IsEnd(modelobject)
def sds2.obj.IsHole | ( | modelobject | ) |
Return True iff the modelobject represents a hole. Example: LocateSingle('Locate hole', IsHole) C++ signature : bool IsHole(modelobject)
def sds2.obj.IsMaterial | ( | modelobject | ) |
Return True iff the modelobject represents a material. Example: LocateSingle('Locate material', IsMaterial) C++ signature : bool IsMaterial(modelobject)
def sds2.obj.IsMember | ( | modelobject | ) |
Return True iff the modelobject represents a member. Example: LocateSingle('Locate member', IsMember) C++ signature : bool IsMember(modelobject)
def sds2.obj.IsWeld | ( | modelobject | ) |
Return True iff the modelobject represents a weld. Example: LocateSingle('Locate weld', IsWeld) C++ signature : bool IsWeld(modelobject)
def sds2.obj.l2g | ( | args | ) |
Local to global for the given generic object return ((m2g(o) if is_mo_m(o) else le2g(o) if is_mo_le(o) else re2g(o) if is_mo_re(o) else mt2g(o) if is_mo_mt(o) else h2g(o) if is_mo_h(o) else b2g(o) if is_mo_b(o) else w2g(o) ) if is_mo(o) else v2g(o) if is_v(o) else l2g(to_mo(o)) )
def sds2.obj.le | ( | args | ) |
return mo_le(hn(generic_member)) Example: assert mo_le(1) == le(member.Member(1))
def sds2.obj.le2g | ( | args | ) |
Left end to global return mo_ref_xform(m(le))
def sds2.obj.lock | ( | args | ) |
return model.LockOnlyThis([m(a) for a in args])
def sds2.obj.locked_ms | ( | args | ) |
all members locked by the current process return model.members(4)
def sds2.obj.m | ( | args | ) |
Convert a member to a model.object member return mo_m(hn(generic_member)) Example: assert (mo_m(1) == m(member.Member(1)) and mo_m(1) == m(member.Member(1).Material(0)) )
def sds2.obj.m2g | ( | args | ) |
Member to global return mo_ref_xform(m)
def sds2.obj.m_gs | ( | args | ) |
return GroupMember.GetGroupsForMember(hn(generic_member))
def sds2.obj.mag | ( | args | ) |
return p3d.Magnitude(pt(v))
def sds2.obj.materials_mo_m | ( | args | ) |
return mo_m.materials
def sds2.obj.mb | ( | args | ) |
return mb_from_mn(hn(generic_member), lock)
def sds2.obj.mb_from_mn | ( | args | ) |
return MemberBase.GetMemberLink(member_number, False, lock)
def sds2.obj.mo_b | ( | args | ) |
return new_mo(m, b=b)
def sds2.obj.mo_b_uuid | ( | args | ) |
return Uuid.FromBuffer(b.guid)
def sds2.obj.mo_e | ( | args | ) |
return new_mo(m, e)
def sds2.obj.mo_e_to_c | ( | args | ) |
Return component corresponding to model.object end return next( ifilter( is_c_ref_pt_at_origin if is_mo_le(end) else lambda c: not is_c_ref_pt_at_origin(c) , filter(is_conn_c, cs_on_mn(host_number_mo(end))) ) , default )
def sds2.obj.mo_h | ( | args | ) |
return new_mo(m, mt=mt, h=h)
def sds2.obj.mo_h_to_hlist | ( | args | ) |
Convert model.object hole to hole_list return (lambda m, mt, h: gen_mt(m, mt).HoleList()[h])(*ijk_mo_h(mo_h))
def sds2.obj.mo_le | ( | args | ) |
return new_mo(m, 0)
def sds2.obj.mo_m | ( | args | ) |
return new_mo(m)
def sds2.obj.mo_m_uuid | ( | args | ) |
return Uuid.FromBuffer(m.guid_manufacturing)
def sds2.obj.mo_mt | ( | args | ) |
return new_mo(m, mt=mt)
def sds2.obj.mo_mt_to_gen_mt | ( | args | ) |
Convert model.object material to gen_mtrl return (lambda i, j: member.Member(i).Material(j))(*ij_mo_mt(mo_mt))
def sds2.obj.mo_mt_uuid | ( | args | ) |
return Uuid.FromBuffer(m.guid)
def sds2.obj.mo_re | ( | args | ) |
return new_mo(m, 1)
def sds2.obj.mo_ref_xform | ( | args | ) |
return xform(mo.ref_xform)
def sds2.obj.mo_repr | ( | args | ) |
return '%s%r' % ('mo', o._as_tuple)
def sds2.obj.mo_to_gen_mt | ( | args | ) |
return mo_mt_to_gen_mt(mo_to_mo_mt(mo)) Example: assert mo_to_gen_mt(mo_h(1,0,0)).modelobject() == gen_mt(1,0).modelobject()
def sds2.obj.mo_to_mo_mt | ( | args | ) |
return mt(*ij_mo_mt(mo)) ;#can return a hole's material Example: assert mo_to_mo_mt(mo_mt(1,0)) == mo_to_mo_mt(mo_h(1,0,0))
def sds2.obj.mo_uuid | ( | args | ) |
return mo_m_uuid(mo) if is_mo_m(mo) else Uuid.FromBuffer(mo.guid)
def sds2.obj.mo_w | ( | args | ) |
return new_mo(m, w=w)
def sds2.obj.mo_w_uuid | ( | args | ) |
return Uuid.FromBuffer(w.guid)
def sds2.obj.modifies_or_empty | ( | args | ) |
return try_or_default(lambda: x.Modifies(), [], except_handler)
def sds2.obj.mt | ( | args | ) |
return (mo_mt(hn(args[0]), args[1]) if len(args) > 1 else args[0] if is_mo_and_mt(args[0]) else args[0].modelobject() if is_gen_mt(args[0]) else mt(*args[0]) ) Example: assert (mo_mt(1,0) == mt(member.Member(1),0) and mo_mt(1,0) == mt((1,0)) and mo_mt(1,0) == mt(mo_mt(1,0)) and mo_mt(1,0) == mt(gen_mt(1,0)) )
def sds2.obj.mt2g | ( | args | ) |
Material to global return mo_ref_xform(mt)
def sds2.obj.mt_end_conn_ij | ( | args | ) |
return mt.mem_conn_idx, mt.mem_conn_end
def sds2.obj.negx | ( | args | ) |
return -x(o)
def sds2.obj.negy | ( | args | ) |
return -y(o)
def sds2.obj.negz | ( | args | ) |
return -z(o)
def sds2.obj.new_mo | ( | args | ) |
mo constructor with keyword args return mo(m, e, mt, h, b, w)
def sds2.obj.optional_m | ( | args | ) |
return try_or_none(lambda: m(generic_member), except_handler)
def sds2.obj.optional_mo_m | ( | args | ) |
return try_or_none(lambda: mo_m(mn), except_handler)
def sds2.obj.pt_repr | ( | args | ) |
return 'pt' + repr(xyz(p))
def sds2.obj.re | ( | args | ) |
return mo_re(hn(generic_member)) Example: assert mo_re(1) == re(member.Member(1))
def sds2.obj.re2g | ( | args | ) |
Right end to global x, y, z = xyz(l2g(m(re))) return xform((-x, y, -z, re.loc))
def sds2.obj.seg | ( | args | ) |
Line segment of the generic object m = l2g(o) return origin(m), wkpt2(o, m)
def sds2.obj.sel | ( | args | ) |
Select args args = selected() if args is None else list(args) return (model.Select(filter(is_mo, args)) + Component.Select(filter(is_c, args)) )
def sds2.obj.sel_es | ( | args | ) |
all selected ends return model.members(3)
def sds2.obj.sel_ms | ( | args | ) |
all selected members return model.members(2)
def sds2.obj.selected | ( | args | ) |
return model.GetSelection() + Component.GetSelectedComponents()
def sds2.obj.set_sel | ( | args | ) |
ds = dsel() return sel(args), ds
def sds2.obj.silently_ignore_exception | ( | args | ) |
silently_ignore_exception(args)
def sds2.obj.solids_creator_uuid | ( | args | ) |
return Uuid.FromBuffer(solids_creator_uuid_buffer(mo))
def sds2.obj.solids_creator_uuid_buffer | ( | args | ) |
return mo.solids_creator_uuid
def sds2.obj.to_mo | ( | args | ) |
if len(args) == 1: a0 = args[0] if isinstance(a0, m0): return a0 elif hasattr(a0, 'modelobject'): return a0.modelobject() else: try: return to_mo(*a0) except: return mo(hn(a0)) return new_mo(*args) if len(args) > 1 else None Example: assert [mo_mt(1,0), mo_h(1,0,0)] == map(to_mo, (gen_mt(1,0), hlist(1,0,0)))
def sds2.obj.to_wkpt2 | ( | args | ) |
Return a function that extracts the vector from wkpt1 to wkpt2 for a generic object o return (negz if is_mo_and_b(o) else negz if is_mo_and_h(o) else x )
def sds2.obj.traceback_warning_list | ( | args | ) |
warning_list('%s %s' % (msg, traceback.format_exc()))
def sds2.obj.try_or_default | ( | args | ) |
try: return f() except Exception, e: except_handler(e) return default
def sds2.obj.try_or_none | ( | args | ) |
return try_or_default(f, None, except_handler)
def sds2.obj.unit | ( | args | ) |
return p3d.Unit(pt(v))
def sds2.obj.unlock | ( | args | ) |
return model.Unlock([m(a) for a in (args if len(args) else locks())])
def sds2.obj.uuid | ( | args | ) |
return mo_uuid(o) if is_mo(o) else o.uuid
def sds2.obj.v | ( | args | ) |
return ((lambda i, j: vs_on_m(i)[j])(*args) if len(args) > 1 else args[0] if is_v(args[0]) else v(*args[0]) )
def sds2.obj.v2g | ( | args | ) |
View to global return inv(v.global_to_view)
def sds2.obj.view_ms | ( | args | ) |
all members in the current view return model.members(1)
def sds2.obj.vis_pt | ( | args | ) |
Visualize p by using it as the anchor to a point location prompt p = pt(p) x = point.PointLocate(msg if msg else 'Anchored@%s' % repr(xyz(p)), point.Point(p)) return x, p
def sds2.obj.vis_pts | ( | args | ) |
return map(vis_pt, pts)
def sds2.obj.vis_vec | ( | args | ) |
Visualize the vector by prompting for a point p then prompting for a second point with an anchor of p+v p = point.PointLocate(msg if msg else 'Locate vector base:') if p: x, p = vis_pt(pt(p) + pt(v), '|%d,%d,%d|==%d' % (v.x, v.y, v.z, mag(v))) return x, v
def sds2.obj.vis_xform | ( | args | ) |
Visualize the matrix vis_pt(origin(m)) map(lambda t: vis_vec(*t) , zip(map(lambda v: scale * v, xyz(m)), ('x', 'y', 'z')) )
def sds2.obj.vs_on_m | ( | args | ) |
return view.GetMemberViews(generic_member)
def sds2.obj.w | ( | args | ) |
return (mo_w(hn(args[0]), args[1]) if len(args) == 2 else args[0] if is_mo_and_w(args[0]) else w(*args[0]) ) Example: assert (mo_w(1, 0) == w(member.Member(1),0) and mo_w(1,0) == w((1,0)) and mo_w(1,0) == w(mo_w(1,0)) )
def sds2.obj.w2g | ( | args | ) |
Weld to global return mo_ref_xform(w)
def sds2.obj.warning_list | ( | args | ) |
param.NonBlockingWarning(msg)
def sds2.obj.welds_mo_m | ( | args | ) |
return mo_m.welds
def sds2.obj.wkpt1 | ( | args | ) |
Work point 1 for generic object o using local to global materix m return origin(m if m else l2g(o))
def sds2.obj.wkpt2 | ( | args | ) |
Work point 2 for a generic object using local to global matrix m m = m if m else l2g(o) return origin(m) + wkpt_slope(o) * to_wkpt2(o)(m)
def sds2.obj.wkpt_slope | ( | args | ) |
Work point slope for generic object o return (o.wkpt_slope if hasattr(o, 'wkpt_slope') else o.len if hasattr(o, 'len') else o.length if hasattr(o, 'length') else wkpt_slope(to_mo(o)) )
def sds2.obj.x | ( | args | ) |
return o.x
def sds2.obj.x3d_repr | ( | args | ) |
return 'xform(%s)' % o
def sds2.obj.xform | ( | args | ) |
Convert matrix_concept to a x3d.Tranform3D return (matrix_concept if type(matrix_concept)==x3d.Transform3D else x3d.Transform3D(*map(pt, matrix_concept)) )
def sds2.obj.xform_repr | ( | args | ) |
return 'xform((%s,%s,%s,%s))' % xyzt(m)
def sds2.obj.xy | ( | args | ) |
return x(o), y(o)
def sds2.obj.xyz | ( | args | ) |
return x(o), y(o), z(o)
def sds2.obj.y | ( | args | ) |
return o.y
def sds2.obj.yz | ( | args | ) |
return y(o), z(o)
def sds2.obj.z | ( | args | ) |
return o.z