| Author |
Message |
freeflyair
Guest
|
Posted:
Wed Jan 12, 2005 10:03 am Post subject:
How obtain the *.bmp from *.dwg with Visual Lisp |
|
|
First,I draw a dwg picture in AutoCAD with Visual Lisp language.
Secondly,I want to transit the picture to bmp with Visual Lisp.
Who know the way?Please tell me.
Thank you .
lily
|
|
| Back to top |
|
 |
Jürg Menzi
Guest
|
Posted:
Wed Jan 12, 2005 3:41 pm Post subject:
Re: How obtain the *.bmp from *.dwg with Visual Lisp |
|
|
Hi Lily
| Code: |
(vla-Export
(vla-get-ActiveDocument (vlax-get-acad-object))
"C:\\Temp\\MyPicture" "BMP"
SelectionSet
)
|
For how to create a VisualLISP selection set visit my homepage -> Free Stuff
and search for 'VxSsetSelect'.
Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch |
|
| Back to top |
|
 |
stephen4444
Guest
|
Posted:
Wed Jan 12, 2005 10:21 pm Post subject:
Re: How obtain the *.bmp from *.dwg with Visual Lisp |
|
|
Hi Jurg,
would this also work if you want to wblock a detail to a specific directory?
Can you rewrite it as a completed lsp?
Thanks.
|
|
| Back to top |
|
 |
Jürg Menzi
Guest
|
Posted:
Thu Jan 13, 2005 10:03 am Post subject:
Re: How obtain the *.bmp from *.dwg with Visual Lisp |
|
|
Hi stephen4444
| Quote: | would this also work if you want to wblock a detail to a specific directory?
Yes, but you've to use the wblock method. To export all formats, use |
MeExportAs (and the subs):
| Code: |
;
; -- Function MeExportAs
; Exports a selection set in the format by 'Typ' argument.
; Copyright:
; ©2005 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
; Fil = File path and name (without extension) [STR]
; Typ = Export type (wmf, sat, eps, dxf, dwg, or bmp) [STR]
; Sst = Selection set (nil for eps or dxf) [PICKSET]
; Return [Type]:
; > Null
; Notes:
; - For eps and dxf formats, the selection set is ignored and the
; entire drawing is exported
; - Overwrites existing files without warning
;
(defun MeExportAs (Fil Typ Sst / AcaDoc TmpSet)
(vl-load-com)
(setq AcaDoc (vla-get-activedocument (vlax-get-acad-object))
TmpSet (MeSsetMake AcaDoc "MeTempSet")
)
(if Sst (vla-AddItems TmpSet (MeSset2ObjArr Sst)))
(if (eq (strcase Typ) "DWG")
(vla-Wblock AcaDoc (strcat Fil "." Typ) TmpSet)
(vla-Export AcaDoc Fil Typ TmpSet)
)
(princ)
)
;
; == Function MeSset2ObjArr
; Converts a selectionset to an array of objects.
; Copyright:
; ©2002 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
; Sst = Selectionset [PICKSET]
; Return [Type]:
; > Array of objects [VARIANT]
; Notes:
; - None
;
(defun MeSset2ObjArr (Sst / CurEnt ObjLst)
(while (setq CurEnt (ssname Sst 0))
(setq ObjLst (cons (vlax-ename->vla-object CurEnt) ObjLst))
(ssdel CurEnt Sst)
)
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray vlax-vbObject (cons 0 (1- (length ObjLst))))
(reverse ObjLst)
)
)
)
;
; -- Function MeSsetMake
; Creates a new selection set or clears an existing one.
; Copyright:
; ©2002 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
; Acd = Document object [VLA-OBJECT]
; Nme = Selection set name [STR]
; Return [Type]:
; > Empty selection set [VLA-OBJECT]
; Notes:
; - None
;
(defun MeSsetMake (Acd Nme / SetCol)
(setq SetCol (vla-get-SelectionSets Acd))
(if (vl-catch-all-error-p
(vl-catch-all-apply 'vla-add (list SetCol Nme))
)
(vla-clear (vla-Item SetCol Nme))
)
(vla-Item SetCol Nme)
)
|
Sample:
(MeExportAs "C:\\Temp\\ExportTest" "dwg" (ssget))
Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch |
|
| Back to top |
|
 |
|
|
|
|