[PythonCAD] DWG reader via perl

Eric Wilhelm ewilhelm at sbcglobal.net
Sun Oct 5 21:56:14 EDT 2003


While it might be interesting to rewrite the dwg read/write library in Perl, I 
don't see myself coming up with the time.  Since I am rewriting the 
CAD::Drawing module to use the openDWG libraries via Inline (where before the 
wrapper was built with swig and has some serious problems,) I've been doing 
some research on how inline works.  See below for a [not-so] nice example.

The structure of my CAD::Drawing module is beginning to show itself.  It looks 
like it will be breaking into the following modules:

CAD::Drawing
	new()
	add<thing> methods
	query methods (Get() GetAddrByColor(), etc)
	delete method(s?)
CAD::Drawing::Calculate
	methods specific to Drawing
CAD::Drawing::Defined
	constants usable by all Drawing::* modules
CAD::Drawing::Manipulate
	Move()
	Copy()
	Clone()
	Rotate()
	Mirror()
	(group functions for performing all of the above)
CAD::Drawing::IO
	(front-end functions)
	load()
	save()
	loadgzip()
	savegzip()
CAD::Drawing::IO::openDWG
	(optional if you have the OpenDwg libraries)
	loaddwg() 
	savedwg()
CAD::Drawing::IO::Image
	saveimg()
CAD::Drawing::IO::PostScript
	saveps
CAD::Drawing::IO::GPLdwg 
	(This is where I will wrap in the pythoncad library)
	loaddwg()
	savedwg()

--Eric

http://www.perl.com/pub/a/2001/02/inline.html
<quote>
use Inline Python;
my $language = shift;
print $language, 
	(match($language, 'Perl') ? ' rules' : ' sucks'),
	"!\n";
__END__
__Python__
import sys
import re
def match(str, regex):
	f = re.compile(regex);
	if f.match(str): return 1
	return 0
</quote>


-- 
The opinions expressed in this e-mail were randomly generated by 
the computer and do not necessarily reflect the views of its owner.
                                        --Management




More information about the PythonCAD mailing list