-
Content Count
337 -
Joined
-
Last visited
-
Days Won
4
Everything posted by shineworld
-
The code is a real crap, I'm just trying the right way to get the thing working, but Python + DelphiVCL + VTK looks like it could go. from delphivcl import * from vtkmodules.vtkRenderingCore import vtkRenderWindow from vtkmodules.vtkRenderingUI import vtkGenericRenderWindowInteractor BASE_CLASS_NAME = WinControl class vclVTKRenderWindowInteractor(BASE_CLASS_NAME): def __init__(self, owner): BASE_CLASS_NAME.__init__(self, owner) self._RenderWindow = None self._Iren = None def __getattr__(self, attr): """Makes the object behave like a vtkGenericRenderWindowInteractor""" if attr == '__vtk__': return lambda t=self._Iren: t elif hasattr(self._Iren, attr): return getattr(self._Iren, attr) else: raise AttributeError(self.__class__.__name__ + " has no attribute named " + attr) def GetRenderWindow(self): if self._RenderWindow is None: hwnd = self.Handle self._RenderWindow = vtkRenderWindow() self._RenderWindow.SetWindowInfo(str(int(hwnd))) self._Iren = vtkGenericRenderWindowInteractor() self._Iren.SetRenderWindow(self._RenderWindow) return self._RenderWindow def Render(self): self.update() def vclVTKRenderWindowInteractorConeExample(): """A simple example that uses the vclVTKRenderWindowInteractor class.""" from vtkmodules.vtkFiltersSources import vtkConeSource from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper, vtkRenderer import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle class MainView(Form): def __init__(self, owner): self.vtk_panel = vclVTKRenderWindowInteractor(self) self.vtk_panel.Parent = self self.vtk_panel.Align = 'alClient' self.vtk_panel.AlignWithMargins = True self.vtk_panel.BevelInner = 'bvNone' self.vtk_panel.BevelKind = 'bkFlat' self.vtk_panel.BevelOuter = 'bvNone' self.vtk_panel.Color = clCream self.vtk_panel.ParentBackground = False self.vtk_panel.Caption = 'Hello World!' # set main form events handlers self.OnClose = self.__on_form_close def __on_form_close(self, sender, action): if sender is None: return if sender == self: action.Value = caFree # initialize application Application.Initialize() Application.Title = "" # create and show view view = MainView(Application) try: def on_timer(Sender): coneActor.RotateX(10) coneActor.RotateY(5) coneActor.RotateY(2.5) widget.GetRenderWindow().Render() timer.interval = 100 view.Show() widget = view.vtk_panel ren = vtkRenderer() widget.GetRenderWindow().AddRenderer(ren) cone = vtkConeSource() cone.SetResolution(8) coneMapper = vtkPolyDataMapper() coneMapper.SetInputConnection(cone.GetOutputPort()) coneActor = vtkActor() coneActor.SetMapper(coneMapper) ren.AddActor(coneActor) widget._Iren.Initialize() # Initialize the interactor widget._Iren.Start() # Start the interactor timer = Timer(None) timer.Interval = 1000 timer.OnTimer = on_timer FreeConsole() Application.Run() finally: view.Destroy() if __name__ == '__main__': vclVTKRenderWindowInteractorConeExample()
-
I have a strange warning in compilation with Sydney 10.4.1 that I just can't understand: procedure TWorkOrderListFrame.WorkOrderFilesGridDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var R: TRect; C: TColor; Value: string; Canvas: TCanvas; PenColor: TColor; BrushColor: TColor; FileIndex: Integer; Data: TWorkOrderData; BackgroundColor: TColor; WorkOrdersSelectedRow: Integer; begin // avoids any change at header row if ARow = 0 then Exit; // checks and gets work order data WorkOrdersSelectedRow := WorkOrdersGrid.Selection.Top; if FWorkOrderManager.GetWorkOrderDataByIndex(WorkOrdersSelectedRow - 1, Data) then // evaluates file index FileIndex := ARow - 1; if (FileIndex < 0) or (FileIndex >= TWorkOrderData.FILE_DATA_SIZE) then Exit; if Data.FileData[FileIndex].FileName = '' then Exit; // recovers canvas Canvas := WorkOrderFilesGrid.Canvas; [dcc64 Warning] osWorkOrderListFrame.pas(946): W1036 Variable 'FileIndex' might not have been initialized The line with the warning is: if (FileIndex < 0) or (FileIndex >= TWorkOrderData.FILE_DATA_SIZE) then Exit; but FileIndex is set just the line above.... Any idea ?
-
Variable might not have been initialized
shineworld replied to shineworld's topic in Delphi IDE and APIs
Normally I use only an internal GIT server (gitea). But this part of the source code was copied with WinMerge from a portable SSD which gave me a lot of issues and I've dismissed it recently. Thank you to all for support. -
Variable might not have been initialized
shineworld replied to shineworld's topic in Delphi IDE and APIs
ohhh I've checked... The pas file was corrupted, I've used WinMerge to copy some line in the past, and IDE shown text "then Exit" but compiler and copy/paste does not.... Fixed replacing all code and now works. So sorry..... -
Variable might not have been initialized
shineworld replied to shineworld's topic in Delphi IDE and APIs
Sorry but procedure TWorkOrderListFrame.WorkOrderFilesGridDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var R: TRect; C: TColor; Value: string; Canvas: TCanvas; PenColor: TColor; BrushColor: TColor; FileIndex: Integer; Data: TWorkOrderData; BackgroundColor: TColor; WorkOrdersSelectedRow: Integer; begin // avoids any change at header row if ARow = 0 then Exit; // checks and gets work order data WorkOrdersSelectedRow := WorkOrdersGrid.Selection.Top; if FWorkOrderManager.GetWorkOrderDataByIndex(WorkOrdersSelectedRow - 1, Data) then // evaluates file index FileIndex := ARow - 1; // <--- Here FileIndex is initialized with ARow (in update cell grid ROW) - 1 because first row is fixed row. if (FileIndex < 0) or (FileIndex >= TWorkOrderData.FILE_DATA_SIZE) then Exit; // <--- here the FileIndex is checked to be inner 0 to TWorkOrderData.FILE_DATA_SIZE - 1) otherwise exit (none to do). if Data.FileData[FileIndex].FileName = '' then Exit; // recovers canvas Canvas := WorkOrderFilesGrid.Canvas; Sincerely FileIndex, at if (FileIndex < 0.... ) it already "defined" but compling phase say "undefined"... -
Variable might not have been initialized
shineworld replied to shineworld's topic in Delphi IDE and APIs
I feel exactly the same way about Hint and Warnings, usually I've got 0/0. They are an indispensable tool to guarantee good code, especially when we are talking about millions of lines in play. At the moment I am compiling this project still with Sydney, although I also have Athens on which I have yet to test many third-party libraries that require more up-to-date versions and generate too many Warnings. -
I alternate with a colleague of mine in development with Athens on the same PC. As soon as Athens 12.1 patch 1 came out, I installed it using the manual procedure. Yesterday my colleague continued working on the same PC, and not knowing that I had already installed the patch manually, he also applied it with Get It, as he saw it in the list of possible updates. Now I find myself with two ways of installing the same patch and I wonder if this may lead to problems in the proper functioning of the environment. I would like to avoid re-installing the whole package and the 20 or so third-party libraries we use from scratch. Any idea whether we have "broken" the toy ?
-
I usually ask my questions about the Delphi code to ChatGPT 4. It is very fast and enougth precise. You can use same chat session to teach it when is wrong and it learn for next responses. Recently I've played with local AI using "ollama" and "mixtral" model for programming. Example in pastebin : https://pastebin.com/wWaLsw1V Mixtral model requires a lot of memory, I've 48GB in my PC, but I don't have a compatible CUDA GPU so will take 4 minutes to get the pastebin result using only I7 CPU.
-
Hi all. I'm trying to convert a layout from PySimpleGUI to DelphiVCL. All works fine but I was not able to put an image in an Image() component programmatically. 1] I get a frame from OpenCV VideoCamera cap with: self.__cap = cv2.VideoCapture(0, cv2.CAP_DSHOW) ret, frame = self.__cap.read() 2] I convert the frame to a png image with: png_image = cv2.imencode('.png', frame)[1].tobytes() Now with PySimpleGUI I just update it with: view.window['image_1'].update(data=png_image) where image_1 = sg.Image(filename='', key='image_1', size=(640, 480)) With DelphiVCL I've created a image_1 = Image(self) and assigned basic parent and props but I don't find a way to update the img (an array of bytes with a PNG image inner). Thank you very much for suggestions.
-
Do you need an ARM64 compiler for Windows?
shineworld replied to Lars Fosdal's topic in Cross-platform
We bought industrial Iot licence version for 45 to 89€ depending by number an type of cores. W10 1908 version. It works very fine. I in will prepare a video next week. -
Do you need an ARM64 compiler for Windows?
shineworld replied to Lars Fosdal's topic in Cross-platform
I've already made 😉 RPI 4b running W10 which execute intel 64 bit native code. A very low cost operator interface for a CNC. Also Open GL works but remain the price of intel to arm just in time conversion. All for lees than 90€... All made with Delphi. An early video of first experiments but well working. https://youtu.be/3u0L4uaigV8?si=H5mApXT-ryQ3EbGc -
Do you need an ARM64 compiler for Windows?
shineworld replied to Lars Fosdal's topic in Cross-platform
A Windows ARM compiler could be interesting because W10/W11 can run in low-cost devices as like as Raspberry overall for kiosk or embedded user panels projects. -
In the past, I was in trouble with web installation so I always downloaded the full iso image.
-
Ok, I'm trying... Uninstall does not ask me anything but the new installation asks if to use an Already Existent License 😉 Before, however, I've clonezilled the C disk 🙂
-
So to get the new 12.1 I've to uninstall and reinstall all by zero? 1] I have got a lot of manually installed 3rd part libraries (13, ... uh...). 2] What happens with the Installation counter? Do they take into account that I've uninstalled it? 2nd question is important because I've two development PCs: 1] main office desktop PC to do work when I'm in the office. 2] A secondary portable notebook to do work when I'm at the customer's factory They are used mutually exclusive, or 1 or 2, but I've already used 2 installations shoots.
-
Will be available as GetIt update ?
-
Do you need an ARM64 compiler for Windows?
shineworld replied to Lars Fosdal's topic in Cross-platform
In my case would be amazing to have a valid Delphi compiler for ARM64 Linux + FMX. A lot is moving in the embedded world based on ARM architectures + Linux and I've also tried FPC + Lazarus (a nightmare...). Dreams are dreams 🙂 -
After Athens patch 1, using GetIt, the compiled programs, in IDE, do not run and notice missing of a DLL: Do you have any info about how to fix it? The message message does not say what to reinstall 🙂
-
Missing VCRUNTIME140D.dll after Athens update
shineworld replied to shineworld's topic in General Help
A forum user suggested me to ask to "Programs and Features" to "Repair" the installed packages "Microsoft Visual C++ 2015-2022 Redistributable (x64)" and "Microsoft Visual C++ 2015-2022 Redistributable (x32)". This worked and solved the issue. I've reported that here to other users. Thanks. -
Antivirus block page access:
-
Modern way to create splash screen from transparent png with edges that blend with the background
shineworld replied to CyberPeter's topic in General Help
Amazing Anders, works perfectly also in Linux with Wine. -
What new features would you like to see in Delphi 13?
shineworld replied to PeterPanettone's topic in Delphi IDE and APIs
So, to use a 3rd part DLL made with C++, eg: MSVC or C++Builder itself, it is necessary to create a Proxy C DLL with C++ Builder. https://blogs.embarcadero.com/how-to-use-a-c-dll-in-any-delphi-program/ -
What new features would you like to see in Delphi 13?
shineworld replied to PeterPanettone's topic in Delphi IDE and APIs
Good to hear but no real match. There are two libraries in git for porting OpenCV to Delphi. Both use a middle-man C DLL made in C++ Builder to access the DLLs... -
What new features would you like to see in Delphi 13?
shineworld replied to PeterPanettone's topic in Delphi IDE and APIs
Delphi can use external DLL made with C. I Delphi13 will be useful to import DLL made with C++ to open road to use directly tools like OpenCV, VTK, numpy, etc. I don't know how complex it is but would be amazing... -
I use practically 90% of TFrame and 10% of TForm. IDE sometimes is wrong to place or list the available TFrame so I add them programmatically. No issue in this way.