Hi,
How to change display line width of one object?
I want to change different line width with different objects.
How can I do?
Kind regards,
Vaker
Hi,
How to change display line width of one object?
I want to change different line width with different objects.
How can I do?
Kind regards,
Vaker
not sure which language you use. Below is a python example on how to change the print width for one or more curves. To see the results in the viewport, make sure to enable print display using the _PrintDisplay
command before running the script.
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def ChangePlotWeight(plot_weight=0):
ids = rs.GetObjects("Select curves", rs.filter.curve, False, True, False)
if not ids: return
pws = Rhino.DocObjects.ObjectPlotWeightSource.PlotWeightFromObject
for id in ids:
rh_obj = rs.coercerhinoobject(id, True, True)
rh_obj.Attributes.PlotWeightSource = pws
rh_obj.Attributes.PlotWeight = plot_weight
rh_obj.CommitChanges()
scriptcontext.doc.Views.Redraw()
if __name__=="__main__":
ChangePlotWeight(plot_weight=2.0)
Note that running the function above without providing the argument plot_weight
will reset the plot weight to the default value 0 (hairline). A negative value will set the curve plot weight to “no print”.
c.
Hi Dale,
I change plot weight for two lines.
“0.13” for left and “2.0” for right.
Vaker
Did you use the PrintDisplay
command like Clement said?
You might have to play with the Thickness setting to get the result you would like.
Hi clement, wim,
Thanks for your help.
It works.
I have another question.
How to open “Print Display Mode” by function without script?
Vaker
you can just script the _PrintDisplay
command and enable / disable it via it’s command line options. Eg. in Python RhinoScript this would be:
import rhinoscriptsyntax as rs
rs.Command("_PrintDisplay _State=On")
c.
Hi clement,
Thanks for your help.
I know how to using script.
I just want to know way with Rhino API(if or not).
Vaker
@Vaker, i guess you need to envoke it using RunConmand
. I do not see a PrintDisplay method in RhinoCommon API.
c.
There isn’t. I’ve added the wish to the pile.
http://mcneel.myjetbrains.com/youtrack/issue/RH-35496
– Dale
Hi Dale,
Thanks for your help
Vaker