明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: tukuitk

我tukuitk又向大虾们发难了^_^

  [复制链接]
 楼主| 发表于 2003-10-14 12:05:00 | 显示全部楼层
我怎样在我的回复中粘贴一个图片呢?我想把界面贴上来!
 楼主| 发表于 2003-10-14 12:09:00 | 显示全部楼层
我用了文件上传,上传也显示成功了,可就是不知图片跑哪去了,看不见!
发表于 2003-10-14 12:19:00 | 显示全部楼层
上传成功后,内容里面会自动多出一串代码,这串代码就是显示文件的,你写内容时不能把它删除了
 楼主| 发表于 2003-10-14 12:29:00 | 显示全部楼层
怎么没有那串代码?
是空的。meflying大哥,我把replace函数编出来了,可以替换单行、多行文字、属性参照值、属性标签文字。真不错,你好历害,佩服佩服!!!
发表于 2003-10-14 12:29:00 | 显示全部楼层
ObjectDBX限制说明

Here are some assumptions that I am going on from my results.  If anyone can
verify them I would appreciate it.
1.) You cannot use setvariable or getvariable functions in the ObjectDBX
file, but commands that depend on these settings adopt the values from the
activedocument in the AutoCAD application.
2.) There is no ActiveUCS, active layer, or active color in the ObjectDBX
file, and these again are adopted from the activedocument in the AutoCAD
application.
3.) You can only use the saveas method to save the ObjectDBX file.(但會失去PreviewThumbnail)
4.) You cannot use the close method to close an ObjectDBX file.
5.) When you use the open method on the dbx_document (opened ObjectDBX file)
it closes the existing file without saving it.  ObjectDBX essentially works
with only 1 drawing file at a time.
 楼主| 发表于 2003-10-14 12:31:00 | 显示全部楼层
受教了,谢谢龙龙仔!
 楼主| 发表于 2003-10-14 12:33:00 | 显示全部楼层
能不能编个EXE文件,在根本不打开CAD的情况下,进行批量替换???
发表于 2003-10-14 12:36:00 | 显示全部楼层
保留失去PreviewThumbnail的辦法(FOR R2000~R2002 ONLY)
;;配合ACADX.ARX

This document describes a method in AcadX which provides
a workaround to a problem that affects VBA and ActiveX
clients which save documents to pre-AutoCAD 2000 .DWG
file formats.

When the Save or SaveAs methods of the Document object
are used to save a document to an earlier DWG release
format (e.g., R14 or earlier), AutoCAD does not generate
a thumbnail preview image for the file.

The AcadXApplication class provides a method that serves
to work around this problem:

MakePreviewImage(Document as Object,[UseCurrentView as Variant])

This method causes AutoCAD to generate a preview
thumbnail for the specified document, which will
be retained when a VBA or ActiveX client uses the
Save or SaveAs methods to save the document to an
earlier release format.

The optional UseCurrentView argument specifies if
the current viewport of the active document is to
be used as the basis for the preview image. If this
value is supplied and is True, the preview image
will have the same view parameters as the current
modelspace viewport. If this value is not supplied,
or is supplied and False, the preview image is a
plan view of the document's model space.

Note: This method is limited in that it will only
create previews of model space views. It will
not create a preview of a layout view as AutoCAD
does when saving a file currently in layout view.

You should first activate the document you are
going to save, then call MakePreviewImage
and pass the Document as the first parameter.

You should call MakePreviewImage just before
calling the Save or SaveAs methods, to ensure the
preview thumbnail is current.

Example:

' Note: You must reference the AcadX type library
'       in the VBA project that uses this.

Public Sub TestMakePreviewImage()
   Dim AcadX As AcadXApplication
   Set AcadX = GetInterfaceObject("AcadX.Application")
   ThisDrawing.Activate
   AcadX.MakePreviewImage ThisDrawing
   ThisDrawing.SaveAs "AcadR14.dwg", acR14_dwg
End Sub

In addition to creating model space previews for
documents saved to earlier release formats, this
method is also useful for generating previews in
documents that are accessed via ObjectDBX ActiveX
services (the AxDbDocument class).  

For example, when you use the AcadDocument.WBlock
method to write a block or selected objects to a
new DWG file, the file will not have a preview
image. You can subsequently load this file into
an AxDbDocument object, and call MakePreviewImage()
to generate a preview of the DWG file produced by
the WBlock method.

When you call this method to create a preview of
a file opened in an AxDbDocument, you should pass
False as the value of the optional UseCurrentView
parameter, to force the preview to include the
entire extents of the document's model space.

In addition, when passing an AxDbDocument object
to any AcadX method as a parameter from Visual
LISP, you should then call the FreeObject method
of the AcadXApplication class, to ensure that
the object is properly released. This is required
due to a bug in Visual LISP, which erroneously
increments the reference count of vla-objects
that are passed as parameters to ActiveX methods.

The following example demonstrates how to open
a drawing using ObjectDBX from Visual LISP, and
generate a preview of the drawing, save it, and
finally releases it using FreeObject:

(vl-load-com)

(defun C:MAKEDWGPREVIEW ( / file dbxdoc acad acadx rslt)
   (if (setq file
          (getfiled "Select Drawing File" "" "dwg" 0)
       )
       (progn
          (setq rslt
                       (vl-catch-all-apply
                         '(lambda ()
                                  (setq acad (vlax-get-acad-object))
                                  (setq dbxdoc
                                     (vla-getInterfaceObject acad
                                        "ObjectDBX.AxDbDocument"
                                     )
                                  )
                                  (setq acadx
                                     (vla-getInterfaceObject acad
                                        "AcadX.Application"
                                     )
                                  )
                                  (vla-open dbxdoc file)
                                  (vlax-invoke-method acadx
                                     'MakePreviewImage
                                     dbxdoc
                                     :vlax-false
                                  )
                                  (vlax-invoke-method AcadX 'SaveAs dbxdoc file)
                               )
                       )
                    )
               (if (vl-catch-all-error-p rslt)
                  (princ (strcat (vl-catch-all-error-message rslt)))
               )
               (if dbxdoc
                  (progn
                (vlax-invoke-method acadx 'FreeObject dbxdoc)
                (vlax-release-object dbxdoc)
                       )
                    )
               (vlax-release-object acadx)
            )
   )
   (princ)
)
发表于 2003-10-14 12:37:00 | 显示全部楼层
多谢龙兄,怎么感觉这个东西像是个人开发的一个很不成熟的东西,
楼主注意了,文件修改后,将不能预览。考虑清楚了再用。
 楼主| 发表于 2003-10-14 12:42:00 | 显示全部楼层
5555555
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-10-2 14:29 , Processed in 0.181542 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表