Article | 70002665 |
Type | Wish |
Product | WebJS |
Version | 1103 |
Date Added | 4/9/2025 12:00:00 AM |
Fixed | 11.4.2 (4/9/2025 12:00:00 AM) |
Submitted by | Efstathios Tsoumas |
Summary
Create a vdPolyface object following a given path and a given section (Generate3dPathSection)
Solution
A new method Generate3dPathSection was added in version 11.4.2
Create a new Polyface object following a given path and drawing a given section It has the following form vdcanvas.Generate3dPathSection (section2d, sectionBasePoint2d, path, SectionAngle, SectionScale, startVector, endVector, TopBottomFaces, drawit, entities) section2d :Array of one or more closed 2d sections sectionBasePoint2d : A point relative to sections array that defines the origin of sections. This point will run over the path line path:An array of points in real world Coordinate System SectionAngle:Angle in radians that sections will be rotated around base point before they mapped on the path line. SectionScale:The ending scale of the section object(the section object will start following the path with scale=1.0 and will end with scale=SectionScale).Set it to 1 for no scale. startVector:The extrution vector of the plane of the start section.If it is null the vector of the start segment is used. endVector:The extrution vector of the plane of the end section.If it is null the vector of the end segment is used. TopBottomFaces:Defines if the start and end caps of the path will be filled. drawit:Defines if the polyface object will be drawn. entities:The entities collection where the line will be added. This can be the entities of layout or a block.If not defined then the created entity is added to active layout. Returns : the new created object. Examples: //Example1 var pface = vdcanvas.Generate3dPathSection([[[-0.2, -0.2, 0], [-0.2, 0.2, 0], [0.2, 0.2, 0], [0.2, -0.2, 0], [-0.2, -0.2, 0]]], [0, 0, 0], [[0, 0, 5], [5, 0, 5], [5, -5, 5], [0, -5, 5]], vdgeo.HALF_PI * 0.5, 5, null, null, true); pface.PenColor = vdConst.colorFromString("1"); //Example2 pface = vdcanvas.Generate3dPathSection([[[-1, -1, 0], [-1, 1, 0], [1, 1, 0], [1, -1, 0], [-1, -1, 0]]], [0, 0, 0], [[0, 0, 0], [5, 0, 0], [5, -5, 0], [0, -5, 0], [0, 0, 0]], 0, 1.0, null, null, false); pface.PenColor = vdConst.colorFromString("2"); //Example 3 var section = vdcanvas.AddCircle([0, 0, 0], 1, false, {}); var path = vdcanvas.AddCircle([0, 0, 0], 10, false, {}); path.ExtrusionVector = [0, 1, 0]; pface = vdcanvas.Generate3dPathSection([vdcanvas.GetEntitySamplePoints(section)], [0, 0, 0], vdcanvas.GetEntitySamplePoints(path), 0, 1.0, null, null, false); pface.PenColor = vdConst.colorFromString("3"); //Example 4 var section = vdcanvas.AddCircle([0, 0, 0], 1, false, {}); var path = vdcanvas.AddArc([0, 0, 0], 10, 0, vdgeo.PI, false, {}); path.ExtrusionVector = [1, 0, 0]; pface = vdcanvas.Generate3dPathSection([vdcanvas.GetEntitySamplePoints(section)], [0, 0, 0], vdcanvas.GetEntitySamplePoints(path), 0, 1.0, null, null, true); pface.PenColor = vdConst.colorFromString("4"); //zoom extets and redraw vdcanvas.SetStdView(vdConst.StdView_ISO_SW); vdcanvas.SetRenderMode(vdConst.RENDERMODE_SHADE_ON); setTimeout(vdcanvas.redraw);