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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Rotate vector object
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

XGhost

10 Posts

Posted - Feb 23 2016 :  22:03:24  Show Profile  Reply
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

w2m

USA
1990 Posts

Posted - Feb 24 2016 :  08:47:03  Show Profile  Reply
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
Go to Top of Page

XGhost

10 Posts

Posted - Feb 24 2016 :  23:07:49  Show Profile  Reply
Thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: