Is it possible to modify default civil 3D object styles with a lisp? My goal is to have a lisp that can change a few different default styles, but I was not able to find any code that could do this.
Below is an example of one style I am trying to modify:
I would like to change the default profile view style from 50h-10v LT to RT to a different style that already exists in the drawing.
Thanks.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Yes, it's possible. Here's some code to get you started.
(vl-load-com) (and (setq *acad* (vlax-get-acad-object)) (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) ) C3D (vl-registry-read C3D "Release") C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) ) C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) ) ) (setq C3Ddoc (vla-get-activedocument C3D)) ) (setq settings (vlax-get c3ddoc 'settings)) (setq pvcmdsettings (vlax-get settings 'profileviewcommandssettings)) (setq createpvsettings (vlax-get pvcmdsettings 'createprofileviewsettings)) (setq stylesettings (vlax-get createpvsettings 'stylesettings)) (vlax-put (vlax-get stylesettings 'style) 'value "Full Grid");;The stylename must exist!!!
Yes, following the example posted previously and modifying for the desired property:
(vl-load-com)
(and (setq *acad* (vlax-get-acad-object))
(setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) )
C3D (vl-registry-read C3D "Release")
C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) )
C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) ) )
(setq C3Ddoc (vla-get-activedocument C3D))
)
(setq settings (vlax-get c3ddoc 'settings))
(setq pointsettings (vlax-get settings 'pointcommandssettings))
(setq pgsettings (vlax-get pointsettings 'createpointgroupsettings))
(setq stylesettings (vlax-get pgsettings 'stylesettings))
(setq style (vlax-get stylesettings 'style))
(vlax-get style 'value)
(vlax-put-property style 'value "Benchmark")
Thank you very much @Jeff_M
you are a great man
Never miss an opportunity to help others
I wish you always be healthy
I am following all your great posts
I realized that no one can help me with this request except you
Because you have a good and wide experience
Thank you very much
HI @Jeff_M
Depending on the code you wrote to me
I gave him a styleLabel of the pointgroup
Dependent form
Is what you wrote good or needs to be modified?
Many thanks
;;; (style_styleLabel "Benchmark" "Elevation Only")
(defun style_styleLabel ( vstyle vstyleL / *ACAD* C3D C3DDOC PGSETTINGS POINTSETTINGS SETTINGS STYLESETTINGS)
(vl-load-com)
(and (setq *acad* (vlax-get-acad-object))
(setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) )
C3D (vl-registry-read C3D "Release")
C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) )
C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) ) )
(setq C3Ddoc (vla-get-activedocument C3D))
)
(setq settings (vlax-get c3ddoc 'settings))
(setq pointsettings (vlax-get settings 'pointcommandssettings))
(setq pgsettings (vlax-get pointsettings 'createpointgroupsettings))
(setq stylesettings (vlax-get pgsettings 'stylesettings))
(setq style (vlax-get stylesettings 'style))
(vlax-get style 'value)
(vlax-put-property style 'value vstyle)
(setq styleL (vlax-get stylesettings 'labelstyle))
(vlax-get styleL 'value)
(vlax-put-property styleL 'value vstyleL)
)
HI @Jeff_M
https://www.theswamp.org/index.php?topic=50637.0&fbclid=IwAR1vacIXbGzIowArsR89vbA-07z3BVvNbaXwd0_1mF... (defun setsgmntlblstyle (linestyle2use arcstyle2use / *ACAD* C3D C3DDOC sgmntCMDSETS sgmntLBLSETS sgmntSTYLE SETS STYLESETS *error*) (vl-load-com) (defun *error* (msg / tmp) (if msg (princ (strcat "\n....error.... " msg)) ) (setq tmp (mapcar '(lambda (x) (vl-catch-all-apply 'vlax-release-object (list x)) ) (list sgmntCMDSETS sgmntLBLSETS sgmntSTYLE SETS STYLESETS c3ddoc c3d *acad*)) ) ) (if (and (setq *acad* (vlax-get-acad-object)) (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) ) C3D (vl-registry-read C3D "Release") C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) ) C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) ) ) (setq C3Ddoc (vla-get-activedocument C3D)) ) (progn (setq sets (vlax-get c3ddoc 'settings)) (setq sgmntcmdsets (vlax-get sets 'generalcommandssettings)) (setq sgmntlblsets (vlax-get sgmntcmdsets 'AddSegmentLabelSettings ) ) (setq stylesets (vlax-get sgmntlblsets 'stylesettings)) (setq linesgmntstyle (vlax-get stylesets 'linelabelstyle)) (setq arcsgmntstyle (vlax-get stylesets 'curvelabelstyle)) (vlax-put arcsgmntstyle 'value arcstyle2use) (vlax-put linesgmntstyle 'value linestyle2use) (*error* nil) ) ) )
I'm sorry
Can you explain to me how to write this part of the code?
I could not arrange these lines of code. How can these words be accessed from the website I attached?
http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib.htm
Then the other site
Until we get to what we want
Excuse me from
If you had a free time
And explain to me supported by pictures or video
How do we get to the sentence (vlax-get sets 'generalcommandssettings
AND
How do we get to the sentence (vlax-get sgmntcmdsets 'AddSegmentLabelSettings )
AND
How do we get to the sentence (vlax-get sgmntlblsets 'stylesettings)
AND
How do we get to the sentence (vlax-get stylesets 'linelabelstyle)
AND
How do we get to the sentence (vlax-get stylesets 'curvelabelstyle)
AND
How do we get to the sentence (vlax-put arcsgmntstyle 'value arcstyle2use)
How do we get to the sentence (vlax-put linesgmntstyle 'value linestyle2use)
Thank you very much
advance
How can we use this sentence as picture?
To write the code
Thank you very much
advance
@hosneyalaa, Click the link for the ParcelLineLabels, you will get this:
Click the Link for the property IAeccSettingAddParcelLineLabel, you will get this:
Click the link for the StyleSettings, then click the link in the next page for the IAecc.... property Yes, you basically need to click 2 links for each property or method you want to get to. Just keep doing this until you get to the end of the links. It's a horrible way of creating a help file, in my opinion, but once you get used to it you can usually find what you need fairly quickly.
I also code in the VLIDE and actually run lines of code as they get added, then use the Inspect option to see what properties are available for an object. You can drill down into them by double clicking on a property in the Inspect window. Here I set the active C3DDocument and Inspect it:
then I double click each property I want to Inspect, as shown in blue in each of the windows, until I get to the final value:
I hope that helps a bit.
Nobody ever showed me how to use Inspect on Objects! Thank you! If I was a bit brighter I might have seen that a long time ago. I've been inspecting using VLAX-DUMP-OBJECT (which is very tedious and not very productive).