Created
November 18, 2021 18:28
-
-
Save danielkrajnik/03ae37edbf975f328b2fe8c6cf95320a to your computer and use it in GitHub Desktop.
Convert hatches imported from a pdf file into trimmed surfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rhinoscriptsyntax as rs | |
#get current color | |
hatchId = rs.GetObject( | |
"Pick one hatch", filter=65536, preselect=True, select=True, | |
subobjects=False) | |
color = rs.ObjectColor(hatchId) | |
#run macro | |
macro = """ | |
selcolor invert hide selprev dupborder invert | |
delete selall planarsrf delete selall join dupborder | |
invert delete selall planarsrf delete selall group show | |
""" | |
rs.Command(macro, echo=False) | |
#set previous color as a new material | |
new_objects = rs.SelectedObjects() | |
for i in new_objects: | |
material_idx = rs.AddMaterialToObject(i) | |
rs.MaterialColor(material_idx, color) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment