Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material pcb translucence support #650

Merged
merged 10 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 79 additions & 1 deletion build-system/erbui/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ def is_rotation (self): return isinstance (self, Rotation)
@property
def is_offset (self): return isinstance (self, Offset)

@property
def is_layer (self): return isinstance (self, Layer)

@property
def is_file (self): return isinstance (self, File)

Expand Down Expand Up @@ -1623,6 +1626,24 @@ def offset (self):
else:
return None

@property
def layer (self):
entities = [e for e in self.entities if e.is_layer]
assert (len (entities) <= 1)
if entities:
return entities [0]
else:
return None

@property
def is_layer_silkscreen (self):
return self.layer == None or self.layer.is_silkscreen

@property
def is_layer_translucence (self):
if self.layer == None: return False
return self.layer.is_translucence



# -- Sticker -------------------------------------------------------------------
Expand Down Expand Up @@ -1882,6 +1903,27 @@ def degree_top_down (self):



# -- Layer -------------------------------------------------------------------

class Layer (Node):
def __init__ (self, keyword_layer):
assert isinstance (keyword_layer, adapter.Keyword)
super (Layer, self).__init__ ()
self.keyword_layer = keyword_layer

@staticmethod
def typename (): return 'layer'

@property
def is_silkscreen (self):
return self.keyword_layer.value == 'silkscreen'

@property
def is_translucence (self):
return self.keyword_layer.value == 'translucence'



# -- File --------------------------------------------------------------------

class File (Node):
Expand Down Expand Up @@ -1913,7 +1955,7 @@ def source_context_part (self, part):

# -- Image -------------------------------------------------------------------

class Image (Node):
class Image (Scope):
def __init__ (self, filepath):
assert isinstance (filepath, StringLiteral) or isinstance (filepath, str)
super (Image, self).__init__ ()
Expand All @@ -1929,6 +1971,24 @@ def file (self):
elif isinstance (self.filepath, str):
return self.filepath

@property
def layer (self):
entities = [e for e in self.entities if e.is_layer]
assert (len (entities) <= 1)
if entities:
return entities [0]
else:
return None

@property
def is_layer_silkscreen (self):
return self.layer == None or self.layer.is_silkscreen

@property
def is_layer_translucence (self):
if self.layer == None: return False
return self.layer.is_translucence



# -- Line --------------------------------------------------------------------
Expand All @@ -1945,6 +2005,24 @@ def points (self):
entities = [e for e in self.entities if e.is_position]
return entities

@property
def layer (self):
entities = [e for e in self.entities if e.is_layer]
assert (len (entities) <= 1)
if entities:
return entities [0]
else:
return None

@property
def is_layer_silkscreen (self):
return self.layer == None or self.layer.is_silkscreen

@property
def is_layer_translucence (self):
if self.layer == None: return False
return self.layer.is_translucence



# -- Manufacturer ------------------------------------------------------------
Expand Down
Loading
Loading