Commit 802bcc2c authored by Dave Cooper's avatar Dave Cooper

trying to add SPLINE support for DXF.

parent 8ae1bd98
......@@ -713,14 +713,26 @@ NOTE: before compiling/loading this file, do:
:objects
((drawing :type 'box-annotated-drawing
:objects (list (the box)))
:display-objects (list (the box) (the curve)))
;;(the curve)
(curve :type 'b-spline-curve
:control-points (list (make-point 0 0 0)
(make-point 4 6.0 0.0)
(make-point 8 4.0 0.0)
(make-point 10 0.0 0.0)
(make-point 8 -4.0 0.0)
(make-point 4 -6.0 0.0)
(make-point 0 0 0)))
(box :type 'box
:length 10 :width 20 :height 30)))
(define-object box-annotated-drawing (base-drawing)
:input-slots (objects (character-size 15)
:input-slots (display-objects (character-size 15)
(witness-line-gap 10)
(witness-line-length 15)
(witness-line-ext 5))
......@@ -730,7 +742,7 @@ NOTE: before compiling/loading this file, do:
:projection-vector (getf *standard-views* :trimetric)
:length (half (the length))
:center (translate (the center) :rear (half (the-child length)))
:objects (the objects)
:objects (the display-objects)
:annotation-objects (list (the main-length-dim)))
......@@ -747,7 +759,7 @@ NOTE: before compiling/loading this file, do:
:projection-vector (getf *standard-views* :front)
:length (half (the length))
:center (translate (the center) :front (half (the-child length)))
:objects (the objects)
:objects (the display-objects)
:annotation-objects (list (the top-length-dim)))
(top-length-dim :type 'vertical-dimension
......
......@@ -421,7 +421,18 @@ the box should be facing. Defaults to <tt>*nominal-y-vector*</tt>."
(let ((scale (the view-scale)))
(map 'list #'(lambda(point)(scalar*vector scale point))
(the arcs-array-2d)))
(the arcs-array-2d)))
(the arcs-array-2d)))
(curves-2d-scaled (when (the curves-2d)
(list
(if (the scale?)
(list :degree (getf (the curves-2d) :degree)
:knot-vector (getf (the curves-2d) :knot-vector)
:weights (getf (the curves-2d) :weights)
:control-points (let ((scale (the view-scale)))
(mapcar #'(lambda(point) (scalar*vector scale point))
(getf (the curves-2d) :control-points))))
(the curves-2d)))))
(path-info-2d-scaled (when (the path-info-2d)
(if (the scale?)
......@@ -434,6 +445,33 @@ the box should be facing. Defaults to <tt>*nominal-y-vector*</tt>."
;;
;; FLAG -- fold code from this and next message into a method function
;;
(curves-2d
(when (typep (the object) 'surf:curve)
(let ((control-points (the object control-points))
(weights (the object weights))
(knot-vector (the object knot-vector))
(degree (the object degree)))
(list :degree degree :knot-vector knot-vector
:weights weights
:control-points
(mapcar
(if (and (keywordp (the view-transform)) (the snap-to-y?))
#'(lambda(point)
(case (the view-transform)
(:top (make-vector (get-x point) (get-y point)))
(:bottom (make-vector (get-x point) (- (get-y point))))
(:rear (make-vector (- (get-x point)) (get-z point)))
(:front (make-vector (get-x point) (get-z point)))
(:right (make-vector (get-y point) (get-z point)))
(:left (make-vector (- (get-y point)) (get-z point)))))
#'(lambda(point)
(subseq
(project-to-plane point 1 (the projection-vector) (the view-transform)
:snap-to (the snap-to)) 0 2))) control-points)))))
(arcs-array-2d
(let ((raw-points (mapsend (the object %arcs%) :center)))
(map 'vector
......
This diff is collapsed.
;;
;; Copyright 2013 Genworks International
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;;
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file. If not, see
;; <http://www.gnu.org/licenses/>.
;;
(in-package :geom-base)
(defparameter *dxf-header*
" 0
SECTION
2
HEADER
9
$ACADVER
1
AC1009
9
$DWGCODEPAGE
3
ANSI_1252
9
$INSBASE
10
0.0
20
0.0
30
0.0
9
$EXTMIN
10
-500.0
20
-500.0
30
1.000000000000000E+20
9
$EXTMAX
10
500.0
20
500.0
30
-1.000000000000000E+20
9
$LIMMIN
10
-500.0
20
-500.0
9
$LIMMAX
10
500.0
20
500.0
9
$ORTHOMODE
70
0
9
$LTSCALE
40
1.0
9
$TEXTSTYLE
7
Standard
9
$LUNITS
70
2
9
$LUPREC
70
4
9
$SPLINESEGS
70
8
9
$INSUNITS
70
4
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
STYLE
70
1
0
STYLE
2
GDLSTYLE
70
0
40
0.0
41
1.0
50
0.0
71
0
42
0.2
3
TXT
0
ENDTAB
0
TABLE
2
LTYPE
70
3
0
LTYPE
2
DASHED
70
64
3
__ __ __ __
72
65
73
2
40
0.75
49
0.5
49
-0.25
0
LTYPE
2
CENTER
70
64
3
___ _ ___ _ ___
72
65
73
4
40
0.75
49
0.4
49
-0.1
49
0.15
49
-0.1
0
LTYPE
2
DASHDOT
70
64
3
__ . __ . __
72
65
73
4
40
0.75
49
0.5
49
-0.12495
49
0.0001
49
-0.12495
0
ENDTAB
0
ENDSEC
0
SECTION
2
ENTITIES
")
(defparameter *dxf-footer*
"0
ENDSEC
0
EOF
")
(define-format dxf (2d-output))
;;
;; Copyright 2013 Genworks International
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;;
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file. If not, see
;; <http://www.gnu.org/licenses/>.
;;
(in-package :geom-base)
(defparameter *dxf-header*
" 0
SECTION
2
HEADER
9
$ACADVER
1
AC1500
9
$DWGCODEPAGE
3
ANSI_1252
9
$INSBASE
10
0.0
20
0.0
30
0.0
9
$EXTMIN
10
-500.0
20
-500.0
30
1.000000000000000E+20
9
$EXTMAX
10
500.0
20
500.0
30
-1.000000000000000E+20
9
$LIMMIN
10
-500.0
20
-500.0
9
$LIMMAX
10
500.0
20
500.0
9
$ORTHOMODE
70
0
9
$LTSCALE
40
1.0
9
$TEXTSTYLE
7
Standard
9
$LUNITS
70
2
9
$LUPREC
70
4
9
$SPLINESEGS
70
8
9
$INSUNITS
70
4
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
STYLE
70
1
0
STYLE
2
GDLSTYLE
70
0
40
0.0
41
1.0
50
0.0
71
0
42
0.2
3
TXT
0
ENDTAB
0
TABLE
2
LTYPE
70
3
0
LTYPE
2
DASHED
70
64
3
__ __ __ __
72
65
73
2
40
0.75
49
0.5
49
-0.25
0
LTYPE
2
CENTER
70
64
3
___ _ ___ _ ___
72
65
73
4
40
0.75
49
0.4
49
-0.1
49
0.15
49
-0.1
0
LTYPE
2
DASHDOT
70
64
3
__ . __ . __
72
65
73
4
40
0.75
49
0.5
49
-0.12495
49
0.0001
49
-0.12495
0
ENDTAB
0
ENDSEC
0
SECTION
2
ENTITIES
")
(defparameter *dxf-footer*
"0
ENDSEC
0
EOF
")
(define-format dxf (2d-output))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment