Dimstyle Object and ObjectDBX

Dimstyle Object and ObjectDBX

Anonymous
Not applicable
752 Views
9 Replies
Message 1 of 10

Dimstyle Object and ObjectDBX

Anonymous
Not applicable
Why is the Dimstyle object so limited and doesn't operate at all like the textstyle object? Does anyone know: Using the high speed background processing of ObjectDBX from vba, how do you get the dimstyles and their settings? - Ted Schaefer, WD Partners
0 Likes
753 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Some code: 'This works Private Sub ProcessTextStyles(oDbxDwg As AxDbDocument) Dim oTxtStyle As AcadTextStyle For Each oTxtStyle In oDbxDwg.TextStyles With oTxtStyle oClsDB.AddTextStyle .Name, .fontFile, .Height, .Width, oDbxDwg.Name End With Next End Sub 'This does NOT work Private Sub ProcessDimStyles(oDbxDwg As AxDbDocument) Dim oDimStyle As AcadDimStyle For Each oDimStyle In .DimStyles With oDimStyle oClsDB.AddDimStyle .Name, .Font, .Rarrow, .Larrow, .lunits, .luprec End With Next End Sub 'This also does NOT work (I thought if I could copy into a blank drawing, I could do something) Private Sub ProcessDimStyles(oDbxDwg As AxDbDocument, Optional lngProtoID As Long = 0) Dim oDs As AcadDimStyle Dim oDsName As String Dim oDwg As AcadDocument Dim oNewDS As AcadDimStyle Set oDwg = ThisDrawing On Error Resume Next For Each oDs In oDbxDwg.DimStyles oDsName = oDs.Name Set oNewDS = oDwg.DimStyles.Add(oDsName) oNewDS.CopyFrom oDs Next End Sub "xxxTed Schaefer" wrote in message news:402a4603$1_2@newsprd01... > Why is the Dimstyle object so limited and doesn't operate at all like the > textstyle object? > > Does anyone know: Using the high speed background processing of ObjectDBX > from vba, how do you get the dimstyles and their settings? > > - Ted Schaefer, WD Partners > >
0 Likes
Message 3 of 10

Speed_CAD
Collaborator
Collaborator
Hi...

Why is there a point in .DimStyle in the code line?

For Each oDimStyle In .DimStyles

I don't see the sentence With

:S
Mauricio Jorquera
0 Likes
Message 4 of 10

Anonymous
Not applicable
I know this is goofy, but what you have to do is use SetVariable to set all of the dim** system variables the way you want them, and then use the copyfrom method of the DimStyle object, specifying your AxDbDocument object as the source object. -- Chuck Gabriel Since when is ignorance a point of view? ------------------------------------------------------------------------ Chuck Gabriel's Profile: http://www.vbdesign.net/expresso/member.php?action=getinfo&userid=16 View this thread: http://www.vbdesign.net/expresso/showthread.php?threadid=25806
0 Likes
Message 5 of 10

Anonymous
Not applicable
is this a typo? > For Each oDimStyle In .DimStyles should it be > For Each oDimStyle In oDbxDwg.DimStyles ??? you might look into posts regarding the difference between axdblib objects and acadlib objects Dim oTxtStyle As AXDB15Lib.AcadTextStyle in lieu of Dim oTxtStyle As AcadTextStyle though I have no idea if that's causing whatever problem you're encountering from looking at your copyfrom example i would have thought that that would have worked. did you confirm the dbx doc was a valid object at the time of calling that sub? hth Mark "xxxTed Schaefer" wrote in message news:402a5561$1_3@newsprd01... > Some code: > > For Each oDimStyle In .DimStyles > 'This also does NOT work (I thought if I could copy into a blank drawing, I > could do something) > Private Sub ProcessDimStyles(oDbxDwg As AxDbDocument, Optional lngProtoID As > Long = 0) > Dim oDs As AcadDimStyle > Dim oDsName As String > Dim oDwg As AcadDocument > Dim oNewDS As AcadDimStyle > > Set oDwg = ThisDrawing > > On Error Resume Next > For Each oDs In oDbxDwg.DimStyles > oDsName = oDs.Name > Set oNewDS = oDwg.DimStyles.Add(oDsName) > oNewDS.CopyFrom oDs > Next > End Sub > > > "xxxTed Schaefer" wrote in > message news:402a4603$1_2@newsprd01... > > Why is the Dimstyle object so limited and doesn't operate at all like the > > textstyle object? > > > > Does anyone know: Using the high speed background processing of ObjectDBX > > from vba, how do you get the dimstyles and their settings? > > > > - Ted Schaefer, WD Partners > > > > > >
0 Likes
Message 6 of 10

Anonymous
Not applicable
Sorry, I erased the With objDbxDoc .... End With - Ted "SpeedCAD" wrote in message news:13920577.1076518784813.JavaMail.jive@jiveforum2.autodesk.com... > Hi... > > Why is there a point in .DimStyle in the code line? > > For Each oDimStyle In .DimStyles > > I don't see the sentence With > > :S
0 Likes
Message 7 of 10

Anonymous
Not applicable
There's no getvar / setvar in ObjectDBX. "Chuck Gabriel" wrote in message news:Chuck.Gabriel.11h52z@vbdesign.net... > > I know this is goofy, but what you have to do is use SetVariable to set > all of the dim** system variables the way you want them, and then use > the copyfrom method of the DimStyle object, specifying your > AxDbDocument object as the source object. > > > -- > Chuck Gabriel > > Since when is ignorance a point of view? > ------------------------------------------------------------------------ > Chuck Gabriel's Profile: http://www.vbdesign.net/expresso/member.php?action=getinfo&userid=16 > View this thread: http://www.vbdesign.net/expresso/showthread.php?threadid=25806 >
0 Likes
Message 8 of 10

Anonymous
Not applicable
Oops. That'll teach me to read more carefully (I hope). -- Chuck Gabriel Since when is ignorance a point of view? ------------------------------------------------------------------------ Chuck Gabriel's Profile: http://www.vbdesign.net/expresso/member.php?action=getinfo&userid=16 View this thread: http://www.vbdesign.net/expresso/showthread.php?threadid=25806
0 Likes
Message 9 of 10

Anonymous
Not applicable
From Tom Nelson, Developer Technical Services. Good reason for ADN. Tom's great! This works - Ted "I could not find any other reference to this particular issue, but I think I have a workaround for you. Using your code, I can copy the Dimstyles into a new drawing, but if I attempt to select one from the Dimstyles dialog, a fatal error results. However, if I put the Dimstyles into an object array, it appears that I can use the CopyObjects method. The following example assumes that I have a drawing "c:\test.dwg", which contains the desired Dimstyles. See below:" Public Sub test() Dim oAxDoc As New AxDbDocument 'Assume c:\test.dwg contains additional dimstyles oAxDoc.Open "c:\test.dwg" Dim objs() As Object Dim oDs As AcadDimStyle Dim i As Integer 'Find the dimstyles in c:\test.dwg For i = 0 To oAxDoc.DimStyles.Count - 1 ReDim Preserve objs(i) Set objs(i) = oAxDoc.DimStyles(i) Next 'Copy the dimstyles across to the new database oAxDoc.CopyObjects objs, ThisDrawing.Database.DimStyles End Sub "xxxTed Schaefer" wrote in message news:402a4603$1_2@newsprd01... > Why is the Dimstyle object so limited and doesn't operate at all like the > textstyle object? > > Does anyone know: Using the high speed background processing of ObjectDBX > from vba, how do you get the dimstyles and their settings? > > - Ted Schaefer, WD Partners > >
0 Likes
Message 10 of 10

Anonymous
Not applicable
Thanks for sharing the solution! :-) Mark "xxxTed Schaefer" wrote in message news:402b8bc8$1_1@newsprd01... > From Tom Nelson, Developer Technical Services. > Good reason for ADN. Tom's great! > This works - Ted >
0 Likes