[Gambas-user] GauchoCAD + LibreDWG

Jussi Lahtinen jussi.lahtinen at gmail.com
Mon Nov 2 00:30:10 CET 2020


Again Dwg_Data contains substructures, which you replace with null pointers.
It really is not easy or small task to implement it on Gambas and I'm not
even sure it is necessary..?
Do you have a working sample file for the sample project, so that I could
try if some simple tricks would work?

Personally I would perhaps write a wrapper library in C, so that libredwg
would be easy to use in Gambas side.


Jussi


On Sun, Nov 1, 2020 at 8:13 PM Martin <mbelmonte at belmotek.net> wrote:

> Well I made an little sample for research with the library because
> GauchoCAD is more complex and difficult to follow the code.
>
> I made an intent of structure translation but I fail again.
>
> Please check the readme.md file in the project there are some info
> relevant.
>
> Regards.
> On 1/11/20 4:19, Jussi Lahtinen wrote:
>
> Just a quick reply, I'll look it further when I have more time.
> It seems you are passing null pointer as an argument. Dwg_Data refers to a
> structure.
> See:
> https://git.savannah.gnu.org/cgit/libredwg.git/tree/include/dwg.h#n8846
> http://gambaswiki.org/wiki/lang/structdecl
>
> Maybe you can just allocate the memory for it, instead of implementing it
> on Gambas.
> Also, please always send a project to demonstrate the problem, instead of
> snipped.
>
> Jussi
>
>
>
> On Sun, Nov 1, 2020 at 4:19 AM Martin <mbelmonte at belmotek.net> wrote:
>
>> Hi.
>> First of all excuse 'nil' knowledge of C since I have just started trying
>> to use the library with Extern, export or whatever is the correct name of
>> the method.
>> I made a module to try to do something with the C library in Gambas, but
>> as expected it doesn't work :-(
>>
>> Note: I am trying to read the number of layers in a dwg plane, I go step
>> by step but the goal is to do many more things
>> See please *dwg.h*
>> https://git.savannah.gnu.org/cgit/libredwg.git/tree/include/dwg.h
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Library "/usr/local/lib/libredwg:0.0.11"
>>
>> 'EXPORT int dwg_read_file (const char *restrict filename, Dwg_Data
>> *restrict dwg);
>> Private Extern dwg_read_file(filename As String, Dwg_Data As Pointer) As
>> Integer
>>
>> 'EXPORT int dxf_read_file (const char *restrict filename, Dwg_Data
>> *restrict dwg);
>> Private Extern dxf_read_file(filename As String, Dwg_Data As Pointer) As
>> Integer
>>
>> 'EXPORT unsigned int dwg_get_layer_count (const Dwg_Data *restrict dwg);
>> Private Extern dwg_get_layer_count(Dwg_Data As Pointer) As Integer
>>
>> Public Function info(f As String) As Pointer
>>
>>   Dim info As Pointer
>>   Dim i As Integer
>>   Dim q As Integer
>>
>>   i = dwg_read_file(f, info)
>>
>>   q = dwg_get_layer_count(info)
>>
>>   Return q
>>
>> End
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>> On 21/10/20 4:00, Jussi Lahtinen wrote:
>>
>> What kind of help do you need?
>> Let's say example, this line:
>> Shell "/usr/local/bin/dwglayers -f '" & sFile & "' 2>&1 " To sOut
>>
>> The problem is to find equivalent function call(s) (in C) from the API
>> documentation. I personally don't have the time.
>> However, many here (including me) can help to translate the C function
>> calls to Gambas extern function calls, if that is needed.
>>
>> Jussi
>>
>> On Wed, Oct 21, 2020 at 3:22 AM Martin <mbelmonte at belmotek.net> wrote:
>>
>>> Hi,
>>> I am pleased to announce that GauchoCAD[1], which as you know is a CAD
>>> made with Gambas, is in good health, at the moment the program is
>>> capable of opening autocad DWG plans (thanks to LibreDWG[2]) that close
>>> LibreCAD[3].
>>> We are using the library with the Shell instruction, which is not the
>>> best in terms of performance.
>>> We need some help in order to do something with Extern or directly a
>>> gb.component that uses this library. Of course, if someone does this it
>>> will be useful for many other projects not just GauchoCAD.
>>>
>>> We need read/write dwg and dxf files more efficiently
>>>
>>> Here we are an script to install LibreDWG in the system
>>>
>>>      #!/bin/bash
>>>      git clone git://git.sv.gnu.org/libredwg.git
>>>      cd libredwg
>>>      sh autogen.sh
>>>      ./configure --enable-trace
>>>      make
>>>      sudo make install
>>>      make check
>>>      cd ..
>>>
>>> [1] https://github.com/tercoide/GauchoCAD
>>>
>>> [2] https://www.gnu.org/software/libredwg/
>>>
>>> [3] https://librecad.org/
>>>
>>> Thanks.
>>> Martin Belmonte
>>>
>>>
>>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201102/0131b1f1/attachment-0001.htm>


More information about the User mailing list