|
NAMECAD::Drawing::Manipulate - Manipulate CAD::Drawing objectsDescriptionMove, Copy, Scale, Mirror, and Rotate methods for single entities and groups of entities.AUTHOREric L. Wilhelm <ewilhelm at cpan dot org>http://scratchcomputing.com COPYRIGHTThis module is copyright (C) 2004-2006 by Eric L. Wilhelm. Portions copyright (C) 2003 by Eric L. Wilhelm and A. Zahner Co.LICENSEThis module is distributed under the same terms as Perl. See the Perl source package for details.You may use this software under one of the following licenses: (1) GNU General Public License (found at http://www.gnu.org/copyleft/gpl.html) (2) Artistic License (found at http://www.perl.com/pub/language/misc/Artistic.html) NO WARRANTYThis software is distributed with ABSOLUTELY NO WARRANTY. The author, his former employer, and any other contributors will in no way be held liable for any loss or damages resulting from its use.ModificationsThe source code of this module is made freely available and distributable under the GPL or Artistic License. Modifications to and use of this software must adhere to one of these licenses. Changes to the code should be noted as such and this notification (as well as the above copyright information) must remain intact on all copies of the code.Additionally, while the author is actively developing this code, notification of any intended changes or extensions would be most helpful in avoiding repeated work for all parties involved. Please contact the author with any such development plans. Group MethodsThese methods are called with required values, followed by a hash reference of option values. Note the difference between this and the individual entity manipulation syntax shown below. The absence of an \%options hash reference implies everything in the drawing.For details about each of the group manipulation methods, see the corresponding individual entity manipulation method. OptionsThe $opts value shown for each of the group manipulation methods is fed directly to CAD::Drawing::select_addr(). See the documentation for this function for additional details.One of the most common methods of selection (after the implicit all) may be the explicit list of addresses. This is done by simply passing an array reference rather than a hash reference. GroupMoveMove selected entities by @dist.$drw->GroupMove(\@dist, $opts); GroupCopyReturns a list of addresses for newly created entities.@new = $drw->GroupCopy(\@dist, $opts); GroupCloneReturns a list of addresses for newly created entities.@new = $drw->GroupClone($dest, $opts); placeClones items from $source into $drw and moves them to @pt. Selects items according to %opts and optionally rotates them by $opts{ang} (given in radians.)$drw->place($source, \@pt, \%opts); GroupMirrorMirrors the entities specified by %options (see select_addr()) across @axis.@new = $drw->GroupMirror(\@axis, \%options); GroupScaleSorry, \@pt is required here.$drw->GroupScale($factor, \@pt, \%opts); GroupRotateRotates specified entities by $angle. A center point may be specified via $opts{pt} = \@pt.$drw->GroupRotate($angle, \%opts); Individual MethodsMoveMoves entity at $addr by @dist (@dist may be three-dimensional.)$drw->Move($addr, \@dist); Copy$drw->Copy($addr, \@dist); CloneClones the entity at $addr into drawing $dest.$drw->Clone($addr, $dest, \%opts); %opts may contain: to_layer => $layer_name, # layer to clone into MirrorMirrors entity specified by $addr across @axis.Returns the address of the manipulated entity. If $opts{copy} is true, will clone the entity, otherwise modify in-place. $drw->Mirror($addr, \@axis, \%opts); Scale$drw->Scale($addr, $factor, \@pt); RotateRotates entity specified by $addr by $angle (+ccw radians) about @pt. Angle may be in degrees if $angle =~ s/d$// returns a true value (but I hope the "d" is the only thing on the end, because I'm not looking for anything beyond that.) $angle = "45" . "d" will get converted, but $angle = "45" . "bad" will be called 0. Remember, this is Perl:)$drw->Rotate($addr, $angle, \@pt); Internal FunctionspointrotateInternal use only.($x, $y) = pointrotate($x, $y, $ang, $xc, $yc); pointmirror@point = pointmirror($axis, $pt); angle_ofangle_of(\@segment); Polygon MethodsThese don't do anything yet and need to be moved to another module anyway.CutPline$drw->CutPline(); IntPline$drw->IntPline(); intersect_pgonintersect_pgon();
Visit the GSP FreeBSD Man Page Interface. |