ObjectDBX, update entity

ObjectDBX, update entity

Anonymous
Not applicable
918 Views
13 Replies
Message 1 of 14

ObjectDBX, update entity

Anonymous
Not applicable
Hi,
I have a task to change a text entity in multiple drawings. I try to use objectDBX. Here are 2 questions:
1. Can anyone give me an idea how to create a file select like windows explore to let user choose multiple files and passing these filenames to sub?
2. Can anyone give me an example of how to use objectDBX open multiple files and process them in the background?
Thanks a bunch.
0 Likes
919 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable
Attached is a zip with a dvb for an OpenSave dialog, which includes a sample
Sub to grab only Drawing files.

For the ObjectDBX portion, just Open, Edit, SaveAs one at a time. If you
must have 2 open at the same time, then you must create 2 instances of an
ObjectDBX object.

Psuedo-code:
Set ODBX = ODBXObject
For Each Dwg in DwgArray
ODBX.Open Dwg
'Edit ODBX FIle
ODBX.SaveAs Dwg
Next

Note that you will need to append the Path to the Dwg file for ObjectDBX to
find it.

wrote in message news:[email protected]...
Hi,
I have a task to change a text entity in multiple drawings. I try to use
objectDBX. Here are 2 questions:
1. Can anyone give me an idea how to create a file select like windows
explore to let user choose multiple files and passing these filenames to
sub?
2. Can anyone give me an example of how to use objectDBX open multiple files
and process them in the background?
Thanks a bunch.
0 Likes
Message 3 of 14

Anonymous
Not applicable
Heh, forgot the zip....

"Jeff Mishler" wrote in message
news:[email protected]...
Attached is a zip with a dvb for an OpenSave dialog, which includes a sample
Sub to grab only Drawing files.
0 Likes
Message 4 of 14

Anonymous
Not applicable
Thanks a lot Jeff.
I am eager to try them.
0 Likes
Message 5 of 14

Anonymous
Not applicable
Excellent help. Just one more question,
When I copy the classmodule OpenSaveClass to my project, and try test(), it cames error "User-defined type not define". I did not remove or add anything. What the point I missed?

Thanks
0 Likes
Message 6 of 14

Anonymous
Not applicable
If I choose more files and the path is very long string, the strFile return emply. How long the string could be in this file select application?

Thanks
0 Likes
Message 7 of 14

Anonymous
Not applicable
I guess you solved your other question from earlier today?

In the ShowOpen procedure of the Class module are these 2 lines:
udtStruct.lpstrFile = Space$(254)
udtStruct.nMaxFile = 255

These control the number of characters allowed in the output string. I just
tested with this:

udtStruct.lpstrFile = Space$(1254)
udtStruct.nMaxFile = 1255

And was able to collect significantly more file names.


wrote in message news:[email protected]...
If I choose more files and the path is very long string, the strFile return
emply. How long the string could be in this file select application?

Thanks
0 Likes
Message 8 of 14

Anonymous
Not applicable
Thanks. Can I add a big number here in case I need open a lot of Files. Let's say 25555.
0 Likes
Message 9 of 14

Anonymous
Not applicable
Uh, try it? Based on the VBA help, I would say yes you can:

There are two kinds of strings: variable-length and fixed-length strings.

a.. A variable-length string can contain up to approximately 2 billion
(2^31) characters.


b.. A fixed-length string can contain 1 to approximately 64K (2^16)
characters.

wrote in message news:[email protected]...
Thanks. Can I add a big number here in case I need open a lot of Files.
Let's say 25555.
0 Likes
Message 10 of 14

Anonymous
Not applicable
Yes, it works. I tried 2^16,65536 works well.

Thanks
0 Likes
Message 11 of 14

Anonymous
Not applicable
One more question, the return string is delimited with space like this:
d:\AA BB CC\DD EE\FFF GGG\folder drawing1.dwg drawing2.dwg drawing3.dwg
it is very difficult to retrieve Path, and each drawing name if the folder name and the filename have spaces(which is normal situation). Do you have any idea how to retieve the path name filenames.
0 Likes
Message 12 of 14

Anonymous
Not applicable
See this test Sub for creating an array which has the Path first, followed
by each filename:

Sub test1()
Dim strFile As String
Dim cOpenSave As New OpenSaveClass

cOpenSave.MultiSelect = True
cOpenSave.Filter = "AutoCAD drawings (*.dwg)|*.dwg"
cOpenSave.Title = "Select File to Open"

strFile = cOpenSave.ShowOpen
Dim vtest As Variant
vtest = Split(strFile, vbNullChar)
End Sub


wrote in message news:[email protected]...
One more question, the return string is delimited with space like this:
d:\AA BB CC\DD EE\FFF GGG\folder drawing1.dwg drawing2.dwg drawing3.dwg
it is very difficult to retrieve Path, and each drawing name if the folder
name and the filename have spaces(which is normal situation). Do you have
any idea how to retieve the path name filenames.
0 Likes
Message 13 of 14

Anonymous
Not applicable
Also, I just noticed that the ShowOpen method returns a string that has an
extra Null character at the end. In the ShowOpen procedure, near the end,
change this line:

ShowOpen = Mid(strTemp, 1, Len(strTemp) - 1)

to this:

ShowOpen = Mid(strTemp, 1, Len(strTemp) - 2)

"Jeff Mishler" wrote in message
news:[email protected]...
See this test Sub for creating an array which has the Path first, followed
by each filename:
0 Likes
Message 14 of 14

Anonymous
Not applicable
Awesome, I leart a lot. It works perfectly.

Thanks Jeff
0 Likes