I am trying to modify the subject code and am having problems. I also see things that raise a number of questions.
One issue is my code to change the Marker Style in a Figure Style throws a run time error. In the function declared by CreateFigureStyle(sStylename As String) As AeccSurveyFigureStyle, I added the following code in a With oFigureStyle block:
.FigureLinesDisplayStylePlan.Layer = "V-SURV-FIGR"
.FigureLinesDisplayStylePlan.Linetype = "BYLAYER"
.AdditionalMarkerStyle.Name = "Survey Sideshot"
The first two work, the third is where the error is generated. The default marker style name is "Basic". As I work on this I have allowed it to modify the style created on the first run and discovered if I edit the style manually to make it "Survey Sideshot" (no quotes) when I rerun the code it does not throw the error.
I even tried changing the name in the Locals window, but the same error occured. In fact, once it is named "Survey Sideshot", I cannot change it back to "Basic" in code or the VBA IDE. I can only change it in the dialog box within the Prospector.
What am I doing wrong?
Also to set the marker syle layer. the code in the example is:
.AdditionalMarkersDisplayStyle2d.color = acByLayer ' example code used blue
but the object properties list
as the properties, not AdditionalMarkersDisplayStyle2d
What's up with that?
Thanks for any guidance you can offer.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Working on home use - 2011. At work, will be 2013 when ready for use.
OK, thanks. The VBA code was originally written for C3D2007 or 2008. Back then the Display Styles were named with 2d and 3d, which have since been changed to Plan and Model. The old names still work to support any older code but since they have been deprecated they no longer show up in the Intellisense. The code ahs not been updated since 2009 due to .NET being the favored customization platform now (VBA development was dropped by MS, plus VBA in a 64 bit environment is horribly slow).
The error, I believe, is coming from trying to change the name of the Marker style. What you want to do, I think, is set the Marker style to use the "Survey Sideshot" style, correct? Well you will need to get the style first and pass that to
.AdditionalMarkerStyle = Markerstyle
The way you've written is to change the current marker style's name to "Survey Sideshot", but that style already exists so it errors.
Hi,
In general while dealing with styles, you should always check if the style already exists in the current DWG file before you add / remove or assign a style to avoid this sort of issues.
Cheers,
Partha
I tried to get the existing marker style, from the existing styles which worked. But an attempt to use
.AdditionalMarkerStyle = oPointMarkerStyle
throws a new error.
I am trying to create in code a survey style and assign some settings using existing styles. As soon as you create a style in memory, it has default settings and you have to re-assign them to another setting if the default settings do not fit your needs. Since I cannot find a place to define the default settings, I have to change the settings that are assigned by default. The problem seems to be with any and all Marker styles.
I added these declarations to the CreateFigureStyle function in the SurveySample.dvb
Set oPointMarkerStyles = g_oAeccDatabase.MarkerStyles
Set oPointMarkerStyle = g_oAeccDatabase.MarkerStyles.Item("Survey Sideshot")
These correcly load all styles and then find SurveySideshot in the styles
Then my line of code to attempt to assign the Survey Sideshot which throws this messages error is:
.AdditionalMarkerStyle = oPointMarkerStyle
I also tried
.AdditionalMarkerStyle.Name = oPointMarkerStyle.Name
which restores my original error.
Update!!!
I modified the code to:
Set .AdditionalMarkerStyle = oPointMarkerStyle
and it worked.
So Jeff_M gets the Sollution after all.