Change or apply style for SectionviewQuanlityTakeOffTable

Change or apply style for SectionviewQuanlityTakeOffTable

Anonymous
Not applicable
1,757 Views
12 Replies
Message 1 of 13

Change or apply style for SectionviewQuanlityTakeOffTable

Anonymous
Not applicable

I want to set style for SectionViewQuanlityTakeoffTable, but this need override property styleId(). Can someone help me? 

0 Likes
1,758 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable

hi,

 

What exactly you are trying to do?

0 Likes
Message 3 of 13

Anonymous
Not applicable
I writing a tool, that create multiple SectionviewQuatityTakeOffTable, but
i can change style of this. Can you give me a solution?
0 Likes
Message 4 of 13

Jeff_M
Consultant
Consultant
Please provide some code that you are using and need help with. That table object has both the StyleId and StyleName properties, so you should be able to pass the name of the style you'd like to use instead of the ObjectId of the style.
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 5 of 13

Anonymous
Not applicable

I give you that code. Can you give me a solution?

 

 

 

Autodesk.Civil.DatabaseServices.Styles.TableStyleCollection TableStyleColl
= _civil.Styles.TableStyles.SectionViewMaterialTableStyles;
ObjectId _IDstyle = TableStyleColl[cmb_Style.SelectedIndex];

foreach (Alignment _Ali in Alignments)
{
ObjectIdCollection _SampleLineGroups =
_Ali.GetSampleLineGroupIds();
foreach (ObjectId _IdSampleGroup in
_SampleLineGroups)
{
SampleLineGroup _SampleLineGroup =
(SampleLineGroup)tr.GetObject(_IdSampleGroup, OpenMode.ForWrite);

QTOMaterialListCollection
_MaterialListColl = _SampleLineGroup.MaterialLists;

if (_MaterialListColl.Count > 0)
{
foreach (SectionViewGroup
_sectionviewGroup in _SampleLineGroup.SectionViewGroups)
{

if
(_sectionviewGroup.GetSectionViewIds().Count > 0)
{
foreach (ObjectId
_IDsectionView in _sectionviewGroup.GetSectionViewIds())
{
SectionView
_SectionView = (SectionView)tr.GetObject(_IDsectionView, OpenMode.ForWrite);

foreach
(QTOMaterialList _MaterialList in _MaterialListColl)
{
Guid Guid =
_MaterialList.Guid;
ObjectId _id =
_SectionView.VolumeTables.

CreateVolumeTable(VolumeTableType.Material, Guid);


_SectionView.VolumeTables.SectionViewAnchorType =
(SectionViewVolumeTableAnchorType)cmb_TypeSectionView.SelectedIndex;

_SectionView.VolumeTables.TableAnchorType =
(SectionViewVolumeTableAnchorType)cmb_TypeTable.SelectedIndex;

_SectionView.VolumeTables.TableLayoutType =
(SectionViewVolumeTableLayoutType)cmb_Horizontal_Vertical.SelectedIndex;


_SectionView.VolumeTables.OffsetX = _X;

_SectionView.VolumeTables.OffsetY = _Y;


SectionViewQuantityTakeoffTable _table =

(SectionViewQuantityTakeoffTable)tr.GetObject(_id,

OpenMode.ForWrite);

*_table.StyleId =
_IDstyle;*


tr.AddNewlyCreatedDBObject(_table, true);
}
}
}

}
}
}
}

Edited by
Discussion_Admin

0 Likes
Message 6 of 13

Jeff_M
Consultant
Consultant

@augusto.goncalves, can you put in a change request to update ALL C3D entities to override the StyleId and StyleName properties? @Anonymous is running into the same issue with the TakeOffTable as others have with Corridors , and I suspect there are other entities which we haven't yet run into. Alternatively, explain how we, as end users, can work around this limitation of the API. It would be real nice if the API were updated for C3D2015 through the current version.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 7 of 13

Anonymous
Not applicable
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> body { font-family: "Calibri","Slate Pro",sans-serif,"sans-serif"; color:#262626 }
I written that code on version 2017. I don't know ways that  override property styleid and stylename.
Sent from my BlackBerry 10 smartphone.
0 Likes
Message 8 of 13

augusto.goncalves
Alumni
Alumni

Sure, will log it. Thanks for the feedback. 

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 9 of 13

ceduca
Explorer
Explorer

Hi,

 

I was with a similar problem. I found this post from @Jeff_M with the solution.

 

https://www.theswamp.org/index.php?topic=41885.msg470105#msg470105

 

Try to convert the object to COM.

I use this with sectionview: 

 

 Dim secViewStyle As Styles.SectionViewStyle = TryCast(trans.GetObject(secViewStyleID, OpenMode.ForRead), Styles.SectionViewStyle) 
Dim secView As SectionView = TryCast(trans.GetObject(secViewId, OpenMode.ForWrite, False, True), SectionView) Dim comViewStyle As AeccLandLib.AeccSectionViewStyle = TryCast(secViewStyle.AcadObject, AeccLandLib.AeccSectionViewStyle) Dim aeccSecview As AeccLandLib.AeccSectionView = TryCast(secView.AcadObject, AeccLandLib.AeccSectionView) aeccSecview.Style = comViewStyle

 

This works for me.

 

 

0 Likes
Message 10 of 13

Anonymous
Not applicable

Thanks ceduca!

I used Object-COM but AeccDbSectionViewQuantityTakeoffTable was protected. I can't use this way. Can you give me any way to unlock or used object-COM ? Thank you so much!

0 Likes
Message 11 of 13

ceduca
Explorer
Explorer

I'm having the same problem now Smiley Sad

0 Likes
Message 12 of 13

Anonymous
Not applicable

A long time, i don't know anyone have ways to resolve that problem?

I hope everyone can give me a solution!

Thanks you so much!

0 Likes
Message 13 of 13

Jeff_M
Consultant
Consultant

@augusto.goncalves , can you check on the status of this? Not being able to change the style of many object types is a real hindrance to those of us trying to make C3D better.

Jeff_M, also a frequent Swamper
EESignature
0 Likes