HELP WITH THIS CODE, please?
-
can someone tell me how to correct this code?
Gracias.
elcorto Argentinamodel = Sketchup.active_model
entities = model.active_entitiespz=[]
pz[0]=[0,-100.mm,0]
pz[1]=[100.mm,-100.mm,0]
pz[2]=[100.mm,-81.mm,0]
pz[3]=[0,-81.mm,0]edges = entities.add_edges([0, 560.mm, 0],[600.mm,560.mm,0],[600.mm,560.mm,720.mm],[0, 560.mm, 720.mm],[0, 560.mm, 0])
facez = entities.add_face pz
facez.followme(edges)By elcorto at 2009-04-21
entities = model.active_entities ancho = 600.mm alto = 720.mm n = 24 r = 100.mm edges = entities.add_edges([0, 0, 0],[ancho/2,0, 0],[ancho,0,0],[ancho, 0, alto],[0, 0, alto],[0, 0, 0],[ancho/2, 0, 0]) circle = entities.add_circle([0,ancho/2,0], X_AXIS, r, n) base = entities.add_face(circle) base.followme(edges)
end
By elcorto at 2009-04-21
-
In the first case, you should should create a curve instead of an array of Edges. Replace
edges = entities.add_edges([0, 560.mm, 0],[600.mm,560.mm,0],[600.mm,560.mm,720.mm],[0, 560.mm, 720.mm],[0, 560.mm, 0])
with
edges = entities.add_curve([0, 560.mm, 0],[600.mm,560.mm,0],[600.mm,560.mm,720.mm],[0, 560.mm, 720.mm],[0, 560.mm, 0])
In the second case, it looks like you want the base to be a semi-circle instead of a circle. You should replace
circle = entities.add_circle([0,ancho/2,0], X_AXIS, r, n) base = entities.add_face(circle)
with
arc = entities.add_arc([0,ancho/2,0], [0, 0, 1], X_AXIS, r, 0.degrees, 180.degrees, n) arc << entities.add_line(arc[arc.length-1].end, arc[0].start) base = entities.add_face(arc)
Hope this at least gets you closer to solving your problems.
Matt
-
muchisimas gracias por tu ayuda.
-
How can I put the two codes in a single dialog box?
And HOW DO PARAMETER?
choose=[ "Frente 1", "Frente 2" ]
enums=[choose.join("|")]
prompts=[ "TIPO", "Ancho", "Alto", "Espesor"]
values=[@choose, 600.mm, 709.mm, 19.mm]
results=inputbox prompts, values, enums, "Parametros del frente"
return if not results
@choose, $a, $b, $c=results###########Frente 1
pz=[]
pz[0]=[0,0,0]
pz[1]=[100.mm,0,0]
pz[2]=[100.mm,-c,0]
pz[3]=[0,-c,0]
edges = entities.add_curve([0, 560.mm, 0],[a,560.mm,0],[a,560.mm,b],[0, 560.mm, b],[0, 560.mm, 0])
facez = entities.add_face pz
facez.followme(edges)###########Frente 2
ancho = 600.mm
alto = 709.mm
n = 24
r = 19.mmedges = entities.add_edges([0, 0, 0],[ancho/2,0, 0],[ancho,0,0],[ancho, 0, alto],[0, 0, alto],[0, 0, 0],[ancho/2, 0, 0])
arc = entities.add_arc([0,ancho/2,0], [0, 0, 1], X_AXIS, r, 0.degrees, 180.degrees, n)
arc << entities.add_line(arc[arc.length-1].end, arc[0].start)
base = entities.add_face(arc)
base.followme(edges)
Muchas gracias.
-
If you don't use @xxx in front of the variable name it will work - xxx. If you use @xxx the last values you entered are remembered. Don't mix @xxx and $xxx like this - I recommend you stay with @xxx. However, you must assign the @xxx values before the dialog first runs - like this [###=changes]
choose=[ "Frente 1", "Frente 2" ] @choose="Frente 1" ### set initial [default] @choose enums=[choose.join("|")] ### you just could use emuns=["Frente 1|Frente 2"] prompts=["TIPO","Ancho","Alto","Espesor"] @a=600.mm if not @a ### set defaults for @a - any changes to @a will be remembered for that session of SUp... @b=709.mm if not @b ### @c=19.mm if not @c ### values=[@choose, @a, @b, @c]### results=inputbox(prompts,values,enums,"Parametros del frente") return nil if not results ### 'nil' @choose,@a,@b,@c=results ### $a >>> @a etc ########### Frente 1 pz=[] pz[0]=[0,0,0] pz[1]=[100.mm,0,0] pz[2]=[100.mm,-@c,0]### pz[3]=[0,-@c,0]### edges=entities.add_curve([0,560.mm,0],[@a,560.mm,0],[@a,560.mm,@b],[0,560.mm,@b],[0,560.mm,0])### a >>> @a etc facez=entities.add_face(pz) facez.followme(edges) ### etc etc
Advertisement