ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Rotate vector object

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
XGhost Posted - Feb 23 2016 : 22:03:24
How to rotate one vector object in ImageEnDBVect
when editing an object that is saved (e.g line);

if use code

var
hobj: Integer;

begin
ImageEnDBVect1.RotateObject(hobj,90,ierObject);
ImageEnDBVect1.Proc.Rotate(90);

I have a message

invalid object index
2   L A T E S T    R E P L I E S    (Newest First)
XGhost Posted - Feb 24 2016 : 23:07:49
Thanks
w2m Posted - Feb 24 2016 : 08:47:03
To rotate objects you must first make sure you obtain the ihObj by setting it to the selected objects. If ihObj is -1 then the object is unknown, so your code will not function. The invalid object index exception occurs because ihObj is -1. This will rotate all selected objects (grips are visible on the object):

procedure TForm1.Rotate1Click(Sender: TObject);
{ Rotate selected objects. }
var
  i: Integer;
  ihObj: Integer;
  iRotateAngle: Integer;
begin
  with ImageEnVect1 do
  begin
    for i := 0 to SelObjectsCount - 1 do
    begin
      if i >= 0 then
      begin
        ObjSaveUndo;
        ihObj := SelObjects[i];
        if ihObj <> -1 then
        begin
          iRotateAngle := 90;
          RotateObject(ihObj, iRotateAngle, ierObject);
        end;
      end;
    end;
    Update;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development