-
Assigning Layer +Line/Curve Style with .net API
Hello all,
I am looking for a .net API routine that can set the layer and line or curve style after selecting multiple line/curve dimensions. I searched for this via LISP, but from what I gathered LISP cannot do this (or at least it would be rather hard to do so) and I believe .net can accomplish this.
Background: I do a lot of Plat based drafting which involves dimensioning lots, plat boundaries, easements, etc, and as I work through the drawing and dimensioning them I have to make sure I assign the proper layer, and line/curve styles to go with everything. This typically involves creating the dimensions, updating the line/curve style for each type of dimension so they look good for the current drawing setup (the baseline styles are embedded in the template), and then matching properties. Sometimes match properties doesn't work though for reasons unknown to me and I have to manually update the settings. I would like to be able to run a command to do so instead of manually having to scroll through all my layers/styles and it'd be nice for when I notice I miss one I could grab it, run the command, and move on. There are mice with extra side buttons you can get (typically for gaming) that I'm thinking it would be really smooth for with this as I could assign commands to those buttons.
I have no experience with API coding (and only light LISP knowledge) so unfortunately I kind of need to be spoon fed here. If I get one routine for the line style I can probably/maybe figure out how to convert it to edit the curve style if it's rather simple (IE: replace the code line that specifies line to curve?) and duplicate it for every type of layer and line/curve style.
A short and sweet version
-Sets the layer to layer X
-Sets Line or Curve label style to Y
Thanks for any and all help!
Edit: After thinking about it I somewhat rescind/alter my previous request. Rather having a command that runs the single segment label command (_AeccAddSegmentLabel) while setting the layer and using a particular line or curve style would be much more ideal.
Thanks again.
-
Re: Assigning Layer +Line/Curve Style with .net API
It appears you are using a vertical (probably Civil 3D) to AutoCAD. In the Drawing Settings, which can be found by a right-click on the drawing name on the Settings tab of the ToolSpace palette, there is a tab labeled Object Layers. This may do what you are wanting to do.
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
... This may do what you are wanting to do.
Yes; it is my understanding, and I could be mistaken, that the OP wants a LISP routine to [implicitly] store the current settings (Object Layer, and Default Style), set the new settings, allow the Objects to be placed accordingly, and then restore same - just as we would with say Dimensions, or MLeaders, etc.
Do you happen to already have something in your toolbox for such? If not, I can help out after some project submittals.
Cheers
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
It appears you are using a vertical (probably Civil 3D) to AutoCAD. In the Drawing Settings, which can be found by a right-click on the drawing name on the Settings tab of the ToolSpace palette, there is a tab labeled Object Layers. This may do what you are wanting to do.
Hi Opie, this does indeed look like an area you can change the default values. The question I have is how do I translate that into either a LISP or dot net code to do it automatically? I thought LISP couldn't handle this type of stuff, but maybe I'm wrong?
We have four different label styles
Distance Only
Bearing + Distance
Bearing + Distance (stacked)
Curve Labels
We then assign them to their respective layer. These bearings/distances are used for lot lines, plat boundaries, and easements so the end goal is to be able to run a command, say ED (Easement- Distance only), and start clicking away at all the easement lines and it will assign the label to the easement layer, and use the easement distance style. Then I may need to do the boundary so I do something like BBDS (Boundary Bearing Distance Stacked) and it sets it to the Boundary layer, and uses the Boundary Bearing/Distance stacked label style. I just hate having to go in and manually update the current label style and layer when I'm dimensioning different things, and on top of that it's easy to miss layers so removing that error is preferred. I prefer automation for this type of stuff when I can.
Quote:
Originally Posted by
BlackBox
Yes; it is my understanding, and I could be mistaken, that the OP wants a LISP routine to [implicitly] store the current settings (Object Layer, and Default Style), set the new settings, allow the Objects to be placed accordingly, and then restore same - just as we would with say Dimensions, or MLeaders, etc.
Do you happen to already have something in your toolbox for such? If not, I can help out after some project submittals.
Cheers
Hi Blackbox,
I believe you're wondering if I have something like this?
Code:
(DEFUN C:EAD()
(setq cancel *error*)
(setq *error* trapdim)
(setq oldlayer (getvar "clayer"))
(initget "E P")
(setq GET1 (getkword "[Existing/Proposed] <Proposed>"))
(COND
((= GET1 "E") (COMMAND "-LAYER" "MAKE" "SE-EASE-TXT" "COLOR" "7" "" ""))
(T(COMMAND "-LAYER" "MAKE" "SP-EASE-TXT" "COLOR" "2" "" ""))
)
(COMMAND "DIMALIGNED" "nea" PAUSE "per")
(setvar "clayer" oldlayer)
(princ)
)
I use this one for easement dimensions. If LISP can tackle this that's great, I was just under the impression it couldn't. I know the command for adding a single segment is "AeccAddSegmentLabel", but I didn't know how to go further from there with telling it to use certain styles.
Thanks!
-
Re: Assigning Layer +Line/Curve Style with .net API
You're partially correct; vanilla AutoLISP cannot do this in the sense that it stores some variables, changes them, does something useful, and then restores same (i.e., the Dimension, MLeader reference above). Where you are (or have been led to be) mistaken, is that Visual LISP (ActiveX COM) can do this, but requires some additional overhead to access Civil 3D's COM-exposed settings, etc. required to accomplish what you're asking for.
To the best of my knowledge, this can all be done in LISP, it's just a matter of who's going to code it first (if it hasn't been coded already; hence my inquiry of Opie's [code] toolbox Haha), and how slow does it perform, given .NET API is often exponentially faster.
... One way, or another... More to follow.
-
Re: Assigning Layer +Line/Curve Style with .net API
Ok I see.
I try to scour the internet a bit before asking for stuff (So glad google became popular as I grew up because the old days sound awful :D ), but of course that doesn't mean it's not hiding somewhere. I did find a handful of bearing/distance routines awhile ago, but they all utilize mtext, and are not dynamic which I felt was too much of a problem.
Whatever you can bring to the table would be greatly appreciated.
-
Re: Assigning Layer +Line/Curve Style with .net API
So I've just had a brief moment to look into this - It appears that the objects needed to complete this task in LISP are Read-Only (to LISP API), so we will have to step up in API:
Code:
(vl-load-com)
(defun c:GetStyleSettings (/ *error* vrsn aeccApp)
(defun *error* (msg)
(if aeccApp
(vlax-release-object aeccApp)
)
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(if
(and
(setq vrsn (getvar 'acadver))
(setq vrsn
(cond
((vl-string-search "20.1" vrsn) "10.5")
((vl-string-search "20.0" vrsn) "10.4")
((vl-string-search "19.1" vrsn) "10.3")
((vl-string-search "19.0" vrsn) "10.0")
((vl-string-search "18.2" vrsn) "9.0")
((vl-string-search "18.1" vrsn) "8.0")
((vl-string-search "18.0" vrsn) "7.0")
((vl-string-search "17.2" vrsn) "6.0")
((vl-string-search "17.1" vrsn) "5.0")
)
)
(setq aeccApp (vla-getinterfaceobject
(vlax-get-acad-object)
(strcat
"AeccXUiLand.AeccApplication."
vrsn
)
)
)
)
(progn
(vlax-dump-object
(vlax-get
(vlax-get
(vlax-get (vlax-get aeccApp 'ActiveDocument) 'Settings)
'GeneralSettings
)
'StyleSettings
)
T
)
(textscr)
)
(prompt
"\n** Unable to interface with \"AeccXUiLand.AeccApplication\" object ** \n"
)
)
(*error* nil)
)
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
BlackBox
So I've just had a brief moment to look into this - It appears that the objects needed to complete this task in LISP are Read-Only (to LISP API), so we will have to step up in API:
I think you are going down the wrong path to assign layers per object type. Those settings are located in the in the ObjectLayerSettings property of the active drawing's DrawingSettings property. When retrieving the Object Layer Settings properties, you'll notice all of the child properties are marked as read-only. Each one of these properties contains additional properties that are write enabled.
Unfortunately, my toolbox for this area is not fully fleshed out at the moment. Otherwise, I would share.
-
Re: Assigning Layer +Line/Curve Style with .net API
Hmmm. I'm trying to keep up with the semi-jargon to me. Sounds like Blackbox thinks this needs to be done in .net, but Opie is disagreeing? Looks like Blackbox was trying to retrieve some information with that code, which I tried in my own cad and it said I was unable to interface with the object.
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
I think you are going down the wrong path to assign layers per object type. Those settings are located in the in the ObjectLayerSettings property of the active drawing's DrawingSettings property. When retrieving the Object Layer Settings properties, you'll notice all of the child properties are marked as read-only. Each one of these properties contains additional properties that are write enabled.
Unfortunately, my toolbox for this area is not fully fleshed out at the moment. Otherwise, I would share.
No worries; you're correct... And it didn't help matters that I had just finished work that night (the next morning?)... This was exactly the reminder I needed, WRT LISP + C3D, and for that I thank you. :beer:
Here's a sample routine to invoke the ADDSEGMENTLABELS Command with the specified settings:
Code:
(defun c:AddSanitaryFlowArrow ()
(_AddSegmentLabels "._addsegmentlabel" "P-SS-TX" "SS Flow Arrows" "SS Flow Arrows")
)
(defun c:AddSanitaryFlowArrows ()
(_AddSegmentLabels "._addsegmentlabels" "P-SS-TX" "SS Flow Arrows" "SS Flow Arrows")
)
;;; Arguments:
;;; commandName newGeneralSegmentLayerName newCurveLabelStyleName newLineLabelStyleName
** Note - the layer is created if it does not yet exist, but the Curve and Line Styles must already exist, or an error will result.
... And here's the dependent sub-function to handle the overhead of starting UNDO, storing the current settings, setting the new settings, and restoring when done, etc.:
Code:
(vl-load-com)
(defun _AddSegmentLabels (commandName newGeneralSegmentLayerName newCurveLabelStyleName
newLineLabelStyleName / *error* vrsn acApp
aeccApp aeccSettings aeccGeneralSegmentLabelLayer aeccGeneralCommandsSettings
aeccSegmentLabelSettings acDoc generalSegmentLayerName curveLabelStyleName
lineLabelStyleName)
(defun *error* (msg)
(if (and generalSegmentLayerName aeccGeneralSegmentLabelLayer)
(vlax-put aeccGeneralSegmentLabelLayer
'Layer
generalSegmentLayerName
)
)
(if (and curveLabelStyleName lineLabelStyleName aeccSegmentLabelStyleSettings)
(progn
(vlax-put aeccSegmentLabelStyleSettings
'CurveLabelStyle
curveLabelStyleName
)
(vlax-put aeccSegmentLabelStyleSettings
'LineLabelStyle
lineLabelStyleName
)
)
)
(if aeccApp
(vlax-release-object aeccApp)
)
(if acDoc
(vla-endundomark acDoc)
)
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(if
(and
(setq vrsn (getvar 'acadver))
(setq vrsn
(cond
((vl-string-search "20.1" vrsn) "10.5")
((vl-string-search "20.0" vrsn) "10.4")
((vl-string-search "19.1" vrsn) "10.3")
((vl-string-search "19.0" vrsn) "10.0")
((vl-string-search "18.2" vrsn) "9.0")
((vl-string-search "18.1" vrsn) "8.0")
((vl-string-search "18.0" vrsn) "7.0")
((vl-string-search "17.2" vrsn) "6.0")
((vl-string-search "17.1" vrsn) "5.0")
)
)
(setq aeccApp (vla-getinterfaceobject
(setq acApp (vlax-get-acad-object))
(strcat
"AeccXUiLand.AeccApplication."
vrsn
)
)
)
(setq aeccSettings (vlax-get (vlax-get aeccApp 'ActiveDocument) 'Settings))
(setq aeccGeneralSegmentLabelLayer
(vlax-get
(vlax-get
(vlax-get
aeccSettings
'DrawingSettings
)
'ObjectLayerSettings
)
'GeneralSegmentLabelLayer
)
)
(setq aeccGeneralSettings (vlax-get aeccSettings 'GeneralSettings))
(setq aeccGeneralCommandsSettings
(vlax-get
(vlax-get (vlax-get aeccApp 'ActiveDocument) 'Settings)
'GeneralCommandsSettings
)
)
(setq aeccSegmentLabelStyleSettings
(vlax-get
(vlax-get
aeccGeneralCommandsSettings
(if (wcmatch (strcase commandName) "*SEGMENTLABELS")
'AddSegmentLabelsSettings
'AddSegmentLabelSettings
)
)
'StyleSettings
)
)
)
(progn
(vla-startundomark
(setq acDoc (vla-get-activedocument acApp))
)
;; store the current settings
(setq generalSegmentLayerName (vlax-get aeccGeneralSegmentLabelLayer 'Layer))
(setq curveLabelStyleName
(vlax-get
(vlax-get aeccSegmentLabelStyleSettings
'CurveLabelStyle
)
'Value
)
)
(setq lineLabelStyleName
(vlax-get
(vlax-get aeccSegmentLabelStyleSettings
'LineLabelStyle
)
'Value
)
)
;; set curve and line label styles
(vlax-put aeccSegmentLabelStyleSettings 'CurveLabelStyle newCurveLabelStyleName)
(vlax-put aeccSegmentLabelStyleSettings 'LineLabelStyle newLineLabelStyleName)
;; create layer if it doesn't exist
(vla-add (vla-get-layers acDoc) newGeneralSegmentLayerName)
(vlax-put aeccGeneralSegmentLabelLayer 'Layer newGeneralSegmentLayerName)
(prompt
(strcat
"\nCurrent Settings: "
"\nGeneral Segment Layer = " generalSegmentLayerName " --> " newGeneralSegmentLayerName
"\nCurve Label Style(s) = " curveLabelStyleName " --> " newCurveLabelStyleName
"\nLine Label Style(s) = " lineLabelStyleName " --> " newLineLabelStyleName
"\n\n "
)
)
(command commandName)
(while (= 1 (getvar 'cmdactive))
(command pause)
)
)
(prompt
"\n** Unable to interface with \"AeccXUiLand.AeccApplication\" object ** \n"
)
)
(*error* nil)
)
** Note - Tested using Civil 3D 2015, but configured to allow functionality in Civil 3D 2008-2016; please report any issues.
Cheers
-
Re: Assigning Layer +Line/Curve Style with .net API
Blackbox, you are the man. Tested it out and seems to work just fine. Looks like I can just copy and paste the command function as much as I want and we're good to go?
I'm in training today and tomorrow so I won't be able to get too into it and make sure everything works without a hitch, but I'm thinking you nailed it.
Thanks!
Edit: Ok so I tested it out on a blank drawing (our instructor is running late :D), seems to work on parcel lines and polylines. Went into an actual plat drawing and it doesn't seem to produce the dimensions. Playing around with it some more, I don't think I have the relevant layers frozen or anything.
Seems the second command works differently than the first (I see it's addsegmentlabelS instead of addsegmentlabel), never played around with the plural version so I'll have to dink around with it at some point. I think, at the very least, that the first command is pretty much exactly what we need. I'll report back later.
Thanks again.
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Varlth
Blackbox, you are the man. Tested it out and seems to work just fine. Looks like I can just copy and paste the command function as much as I want and we're good to go?
I'm in training today and tomorrow so I won't be able to get too into it and make sure everything works without a hitch, but I'm thinking you nailed it.
Thanks!
That is kind of you to say, Varlth; I'm happy to help. :beer:
I coded it to be dependent on a sub-function with parameters, so you could do just that - copy + customize the sample calling routine to build a small contingent of 'quick Segment Label commands' as needed (i.e., Sanitary, Storm, Water, Base Lines, Plats, etc.), and the dependent sub-function does all of the work for you.
Just be mindful that the sub-function must be loaded in order for the calling functions to work - I'd suggest placing your various custom 'quick' commands and the dependent sub-function in a single LISP file, and use an AUTOLOAD Statement to demand-load the routine.
Good luck on your training, and let me know how this works out for you.
Cheers
-
Re: Assigning Layer +Line/Curve Style with .net API
Yeah I see how the two correlate, I glanced over the dependent function and didn't see anything specific that I'd need to edit/watch out for so that's why I was looking for confirmation on just copying the command. I have a dubbed "master" routine that I put anything that doesn't affect drawing settings on load that anyone in the company can safely load by default and I was just planning to throw all of it into that file.
I've never had to use the addsegmentlabels function though, which I see you wrote for as well. It seems to be set up to dimension an entire lot, but it's dependent on the lot's current layer instead of setting the layer you want. Interesting though, and I'll have to play around with it to see if I like it.
Now I have to go through and make sure all my line styles are set properly in the template (and I believe one or two isn't...). I'll probably report back Thursday or Friday sometime mid day CST time.
-
Re: Assigning Layer +Line/Curve Style with .net API
Just wanted to report back in like I said I would. Looks like it's working just as advertised now. Got the template sorted out, and going forward on future drawings this will be easy to use. I use 2016 and it works fine for me so I assume other versions shouldn't have any issue.
Thanks again Blackbox, and thanks Opie for pointing him in the right direction!
-
Re: Assigning Layer +Line/Curve Style with .net API
Hm...
Some mediocre news.
The routine works fine for the most part, but if it's used on a parcel line it grabs the parcel's layer instead of setting the layer defined in the routine. I noticed this on the segmentS command when I played with it, but now see it's happening whenever you use the command on a parcel segment.
Any ideas on this? Normally I would think to add some sort of set layer function before the command is run, but I have the layer set to SP-PL anyways and it uses the O-PRCL layer regardless because that's the layer the lot line is on.
Thanks
edit: Also, I don't know if this matters much or not, but since this is being solved by lisp we could probably move this to the appropriate forum.
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Varlth
Hm...
Some mediocre news.
The routine works fine for the most part, but if it's used on a parcel line it grabs the parcel's layer instead of setting the layer defined in the routine. I noticed this on the segmentS command when I played with it, but now see it's happening whenever you use the command on a parcel segment.
Any ideas on this? Normally I would think to add some sort of set layer function before the command is run, but I have the layer set to SP-PL anyways and it uses the O-PRCL layer regardless because that's the layer the lot line is on.
Thanks
edit: Also, I don't know if this matters much or not, but since this is being solved by lisp we could probably move this to the appropriate forum.
Parcel labels are also a property of the ObjectLayerSettings property.
-
Re: Assigning Layer +Line/Curve Style with .net API
Hi Opie,
Sorry I took awhile to get back. Had to sideline working with this cause of workload.
I took a look at Blackbox's code, but I'm honestly lost at what to do with the ObjectLayerSettings property. I can see it being used in his code, but I have no idea where to go beyond that unfortunately.
-
Re: Assigning Layer +Line/Curve Style with .net API
I had not actually looked for that specific property when commenting and, unfortunately, have found that specific property is not exposed (at least in 2013) to LISP. Sorry.
-
Re: Assigning Layer +Line/Curve Style with .net API
I'll check newer versions here to see if they've exposed the subsequent property being requested.
If not, the two options are to either port the earlier code to .NET in entirety, or to write a custom LispFunction Method thereby 'exposing' same.
For reference:
http://docs.autodesk.com/CIV3D/2016/...fdba465699.htm
-
Re: Assigning Layer +Line/Curve Style with .net API
2016 does not show it either. :(
BTW, BB, the code you posted above for version checking of C3D could be automated to detect the active version of Civil 3D.
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
No, it cannot... As the code you reference, while succinct, is performing the exact same string concatenation as the code which I posted earlier... Just at a substantial decrease in performance.
Here's a quick speed test to demonstrate, where I've intentionally commented out the calls to interface with the 'AeccXUiLand.AeccApplication' Object, so this test merely compares the time taken to yield the required string result in order to obtain same.
Code:
_$ (_FOO1)
"10.4"
_$ (_FOO2)
"10.4"
_$
Sample sub-functions:
Code:
(vl-load-com)
(defun _FOO1 (/ vrsn aeccApp)
(setq vrsn (getvar 'acadver))
(setq vrsn
(cond
((vl-string-search "20.1" vrsn) "10.5") ; 2016
((vl-string-search "20.0" vrsn) "10.4") ; 2015
((vl-string-search "19.1" vrsn) "10.3") ; 2014
((vl-string-search "19.0" vrsn) "10.0") ; 2013
((vl-string-search "18.2" vrsn) "9.0") ; 2012
((vl-string-search "18.1" vrsn) "8.0") ; 2011
((vl-string-search "18.0" vrsn) "7.0") ; 2010
((vl-string-search "17.2" vrsn) "6.0") ; 2009
((vl-string-search "17.1" vrsn) "5.0") ; 2008
)
)
;;; (setq aeccApp (vla-getinterfaceobject
;;; (vlax-get-acad-object)
;;; (strcat
;;; "AeccXUiLand.AeccApplication."
;;; vrsn
;;; )
;;; )
;;; )
)
(defun _FOO2 (/ c3d)
(setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
(if vlax-user-product-key
(vlax-user-product-key)
(vlax-product-key)
)
)
)
(setq C3D (vl-registry-read C3D "Release"))
(setq C3D
(substr
C3D
1
(vl-string-search "." C3D (+ (vl-string-search "." C3D) 1))
)
)
;;; (setq C3D (vla-getinterfaceobject
;;; *acad*
;;; (strcat "AeccXUiLand.AeccApplication." C3D)
;;; )
;;; )
)
Results from VLIDE console:
Code:
_$ (bench '(_FOO1 _FOO2) '() 10000)
_FOO1
Elapsed: 46
Average: 0.0046
_FOO2
Elapsed: 203
Average: 0.0203
_$
... I think I'll stick with my CONDitional statement, and put in the arduous time needed to update the nested list of decending test expressions once a year. http://www.theswamp.org/Smileys/other/tongue.gif Haha
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
I had not actually looked for that specific property when commenting and, unfortunately, have found that specific property is not exposed (at least in 2013) to LISP. Sorry.
Well at least that means, on some level, I was aware of that haha. I stared as Blackbox's code for a bit, and I just couldn't see how I was supposed to alter it.
Quote:
Originally Posted by
BlackBox
No, it cannot... As the code you reference, while succinct, is performing the exact same string concatenation as the code which I posted earlier... Just at a substantial decrease in performance.
Here's a quick speed test to demonstrate, where I've intentionally commented out the calls to interface with the 'AeccXUiLand.AeccApplication' Object, so this test merely compares the time taken to yield the required string result in order to obtain same.
... I think I'll stick with my CONDitional statement, and put in the arduous time needed to update the nested list of decending test expressions once a year.
http://www.theswamp.org/Smileys/other/tongue.gif Haha
Uh-oh. Opie and Blackbox are about to get into a code fight. Taking bets now.
Anyways, whenever this can get resolved (cause it sounds like it can?) is good enough for me. I wish I could do this on my own instead of pester for updates, but as of now I just lack the ability to do so. I swear someday I'm going to actually learn this coding beyond my meager understanding now.
Thanks
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
BlackBox
No, it cannot... As the code you reference, while succinct, is performing the exact same string concatenation as the code which I posted earlier... Just at a substantial decrease in performance.
Irregardless of speed, you contradict yourself in the same paragraph. The link was suggesting the string can be derived from the software possibly without further programmer intervention when the next release comes out. Of course, it is up to the programmer to utilize the best solution for the program at hand.
Naturally, if one must determine this value often enough in the current drawing session, it will be a drag on performance. However, even in the execution of one routine, one should not be reading this value repeatedly during the time of execution.
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
Regardless of speed....
There are only two reasons why I invest time and effort to write code - Do more work in less time (read speed), or to do something that is not otherwise already possible (read new functionality) - So I'm a bit biased. Haha
Quote:
Originally Posted by
Opie
... you contradict yourself in the same paragraph.
I've always appreciated your keeping others (me) in check - Kindly identify where I've contradicted myself in that paragraph, and I'll gladly clarify/correct my statement accordingly.
Quote:
Originally Posted by
Opie
The link was suggesting the string can be derived from the software possibly without further programmer intervention when the next release comes out.
I prefer clarity to agreement, just as I prefer reliability to speculation... The CONDitional statement shall work for all included versions, regardless of any changes Autodesk makes to Registry, exposed API Properties, etc. in newer versions... To boot, I can spare the few extra lines of code. Haha
For the purposes of clarity, the code posited in the aforementioned link actually derives the string from the Registry, and not the Application instance (what most refer to as 'the Software').
That said, I'm not here to win anyone over - I learn from others' experience and insight, I do what I want with that knowledge, and offer that work for others to cull what they like.
Cheers
-
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
Naturally, if one must determine this value often enough in the current drawing session, it will be a drag on performance. However, even in the execution of one routine, one should not be reading this value repeatedly during the time of execution.
Completely agreed; it is unfortunate that LISP does not benefit from Fields, and other .NET aspects across a given Namespace or within scope (rather than being natively Synchronous), as that would greatly reduce the number of Transactions required to iterate a selection set, instances of external Interface Objects, etc., and increase performance in kind.
Hooray .NET API! Haha
-
Re: Assigning Layer +Line/Curve Style with .net API
Is there any update on this?
Thanks
-
Re: Assigning Layer +Line/Curve Style with .net API
So I've been away from this thread for a while, but finally got fired up with this issue on a recent drawing, and discovered Object Layers nestled deep within the Drawing Settings under toolspace. From what I gather this is the property Opie and BB were talking about not being available to manipulate?
This does still lead me to what BB said earlier, which seems to be saying that there is/was a possible workaround?
Quote:
Originally Posted by
BlackBox
I'll check newer versions here to see if they've exposed the subsequent property being requested.
If not, the two options are to either port the earlier code to .NET in entirety, or to write a custom LispFunction Method thereby 'exposing' same.
For reference:
http://docs.autodesk.com/CIV3D/2016/...fdba465699.htm
Thanks
-
Re: Assigning Layer +Line/Curve Style with .net API
Any chance you can share some info on how to do the same with pipe network layer?
Thanks!