AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Valued Mentor
kevin.barnett
Posts: 397
Registered: ‎08-13-2007
Message 1 of 7 (182 Views)
Accepted Solution

C3D 2012 Sampleline Station change

182 Views, 6 Replies
11-05-2012 08:49 PM

Greetings,

C3D 2012

c#

I am trying to change the station of a sample line with code.

I could not find the property in the managed reference, but it appears to be available in the COM.

COM help under SampleLine properties:

LockToStation.. Gets or sets the boolean value that specifies whether the sample line is locked to the station.

Station ...  Gets or sets the alignment station for this sample line.

In my code I set LockTostation to false then alter the station value, but ... the SampleLine station does not change.

What have I missed?

Thx.

Kevin.

 

Problem located ... the station equation were 'incorrect' like this:

staeq.PNG

C3D/the API refuses to change the sample line object stations in these regions UNTIL all columns (raw station back, station back, and station ahead) have the same values - then it works ..  like this ..

x1.png

ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 2 of 7 (176 Views)

Re: C3D 2012 Sampleline Station change

11-05-2012 10:53 PM in reply to: kevin.barnett

Hi Kevin,

 

It seems you have taken the right steps. Check if you have given a valid Station value.

 

I have blogged a code snippet here :

 

http://adndevblog.typepad.com/infrastructure/2012/11/editing-station-property-of-a-sampleline-using-...

 

Hope this helps!

Thanks,



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Valued Mentor
kevin.barnett
Posts: 397
Registered: ‎08-13-2007
Message 3 of 7 (175 Views)

Re: C3D 2012 Sampleline Station change

11-05-2012 11:02 PM in reply to: Partha.Sarkar
The only difference I can see is ... You have a trans.commit() line after the sample station property setting. I do not have transaction defined in my code, did not know it was needed for COM. I could not see the definition of the trans variable in the example. How is it defined? Thx, Kevin..
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 4 of 7 (170 Views)

Re: C3D 2012 Sampleline Station change

11-06-2012 03:27 AM in reply to: kevin.barnett

Dim trans As Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()

 

Thanks,

 



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Valued Mentor
kevin.barnett
Posts: 397
Registered: ‎08-13-2007
Message 5 of 7 (165 Views)

Re: C3D 2012 Sampleline Station change

11-06-2012 04:39 AM in reply to: kevin.barnett

I have now tested the code on new drawings, the code works, sample line stations update/change.. it is not working in the work drawing where I need it to work… will post when I discover the problem preventing the station change..

Valued Mentor
kevin.barnett
Posts: 397
Registered: ‎08-13-2007
Message 6 of 7 (161 Views)

Re: C3D 2012 Sampleline Station change

11-06-2012 05:41 AM in reply to: kevin.barnett

Aha!!! The alignment has station equations when I remove some the problem is resolved in the region without station equations ... will continue research tomoro ...

Valued Mentor
kevin.barnett
Posts: 397
Registered: ‎08-13-2007
Message 7 of 7 (154 Views)

Re: C3D 2012 Sampleline Station change

11-06-2012 09:01 PM in reply to: kevin.barnett

Problem located ... the station equation were 'incorrect' like this:

staeq.PNG

C3D/the API refuses to change the sample line object stations in these regions UNTIL all columns (raw station back, station back, and station ahead) have the same values - then it works ..  like this ..

x1.png

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!