Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Tronco de cone no Illustrator

New Here ,
Jul 25, 2024 Jul 25, 2024

Alguém sabe se existe algum script para gerar uma planificação de tronco de cone de forma simples no Ai?

TOPICS
How-to , Scripting
259
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jul 25, 2024 Jul 25, 2024

Hi @Priscila38409341thj8  could you please post an example?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 26, 2024 Jul 26, 2024
LATEST

Simmm! Algo como isso aqui: 
que faça o processo de forma automática e não manual. Quais-sao-os-elementos-do-tronco-de-cone.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 26, 2024 Jul 26, 2024

Hola, probá con este script, espero te sirva.

 

/**********************************************************************************************
 *                                                                                            *
 *                                    Etiqueta Troncopiramidal                                *
 *                                                                                            *
 *  Calculo de la forma desplegada de una etiqueta de papel para envolver una superficie de   *
 *  Cono truncado tipo balde de pintura.                                                      *
 *                                                                                            *
 **********************************************************************************************/


var mm = 2.83465;               // Conversión de mm a puntos que es la unidad de trabajo en js
var anchoTotal = 210 * mm;
var altoTotal = 297 * mm;

// 1 grado  =  0.0174532925 radianes
// 1 radian =  57.2957795 grados

var r1 = 40 * mm;
var r2 = 50 * mm;
var h = 80 * mm;

// Ventana de ingreso de datos
var DimW = new Window("dialog", "Dimensiones");
DimW.orientation = "column";
DimW.alignChildren = "right";
var DimGroup1 = DimW.add("group");
DimGroup1.orientation = "row";
DimGroup1.add("statictext", undefined, "Radio Menor (mm):");
var txt1 = DimGroup1.add("edittext", undefined, "40");
txt1.characters = 10;
txt1.active = true;
var DimGroup2 = DimW.add("group");
DimGroup2.add("statictext", undefined, "Radio Mayor (mm):");
var txt2 = DimGroup2.add("edittext", undefined, "50");
txt2.characters = 10;
txt2.active = false;
var DimGroup3 = DimW.add("group");
DimGroup3.add("statictext", undefined, "Altura (mm):");
var txt3 = DimGroup3.add("edittext", undefined, "80");
txt3.characters = 10;
txt3.active = false;
var myButtonGroup = DimW.add("group");
myButtonGroup.alignment = "right";
myButtonGroup.add("button", undefined, "OK");
myButtonGroup.add("button", undefined, "Cancel");
DimW.show();

r1 = parseFloat(txt1.text) * mm;
r2 = parseFloat(txt2.text) * mm;
h = parseFloat(txt3.text) * mm;


// Crea un documento nuevo en CMYK y con tamaño A4 (la medida expresada en puntos, 1 punto = 0,352778 mm)
var docPreset = new DocumentPreset;
docPreset.width = anchoTotal;
docPreset.height = altoTotal;
docPreset.units = RulerUnits.Millimeters;
docPreset.artboardLayout = DocumentArtboardLayout.GridByCol;
docPreset.numArtboards = 1
var doc = app.documents.addDocument(DocumentColorSpace.CMYK, docPreset);


var Troquel = doc.activeLayer;  // La variable Troquel toma la capa actual
Troquel.name = "Troquel";       // Le cambia el nombre a la capa actual

doc.defaultFilled = false;      // Por defecto todos los elementos creados
doc.defaultStroked = true;      // no tienen relleno y si tienen borde



var H = h * r2 / (r2 - r1);
var LT = Math.sqrt(r2 * r2 + H * H);
var L = Math.sqrt((r2 - r1) * (r2 - r1) + h * h);
var LR1 = LT - L;
var Alfa = r2 * 360 / LT;

var conoBase = doc.pathItems.add();
conoBase.setEntirePath(Array(Array(-r2, 0), Array(r2, 0)));

var conoTapa = doc.pathItems.add();
conoTapa.setEntirePath(Array(Array(-r1, h), Array(r1, h)));

var conoIzq = doc.pathItems.add();
conoIzq.setEntirePath(Array(Array(-r2, 0), Array(0, H)));

var conoDer = doc.pathItems.add();
conoDer.setEntirePath(Array(Array(r2, 0), Array(0, H)));

var circInf = doc.layers[0].pathItems.ellipse(H + LT, -LT, 2 * LT, 2 * LT, false, true);

var circSup = doc.layers[0].pathItems.ellipse(H + LR1, -LR1, 2 * LR1, 2 * LR1, false, true);

var supIzq = doc.pathItems.add();
var anguloTotal = (Math.asin(r2 / LT) * 57.2957795 + Alfa) - 90;
supIzq.setEntirePath(Array(Array(0, H), Array(LT * Math.cos(anguloTotal * 0.0174532925), H + LT * Math.sin(anguloTotal * 0.0174532925))));

var textRef = doc.textFrames.add();
textRef.contents = "Radio Menor = ";
textRef.contents += r1 / mm;
textRef.contents += "\nRadio Mayor = ";
textRef.contents += r2 / mm;
textRef.contents += "\nAltura = ";
textRef.contents += h / mm;
textRef.contents += "\nAlfa = ";
textRef.contents += Alfa;
textRef.contents += "º";
textRef.top = 500;
textRef.left = 100;
textRef.textRange.characterAttributes.size = 16;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines