That reconcile thing, ...again.

Anonymous

That reconcile thing, ...again.

Anonymous
Not applicable

Since this post --> https://forums.autodesk.com/t5/autocad-forum/reconcile-layer-script/m-p/7512825#M905394  from 2017, has there been any progress?

LAYERNOTIFY LAYEREVAL LAYEREVALCTL effect level of feedback but seem excluded from the command line.

 

Maybe the question needs to be rephrased.

Somewhere, a test is made for new or changed layers. 
That produces a boolean or bitcode flag.
Where is THAT value stored?

 

If the answer is "nowhere",  No way.

If the answer is 'nowhere the user can easily reach",    Well that's typical.

If the answer is "yup! progress made",    Please illuminate before I start repurposing one of JTB's cool functions?

 

thx

b

 

0 Likes
Reply
1,700 Views
21 Replies
Replies (21)

pendean
Community Legend
Community Legend
What is your actual challenge if I may ask? please explain your issue and your desired results, disregard anything from the other post you linked to.



0 Likes

Anonymous
Not applicable

it just boils down to getting -LAYER E * to run without catching on a dwq thats clean of any unreconciled layers.

i.e.

-LAYER
Current layer:  "0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]: E
No unreconciled layers in drawing.
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]: *
Invalid option keyword.
; error: Function cancelled

 

0 Likes

cadffm
Consultant
Consultant

>Where is THAT value stored?

You are able to adk your help? Or what is the question? - Please explain if i didn't understand it well.

 

"it just boils down to getting -LAYER E * to run without catching on a dwq thats clean of any unreconciled layers."

It sounds you are asking of the the simplest answer so long you can not change the program.

(But you can disable the check for it, even a way to be happy).

If you start to create automations, stop guessing, start to make sure.

Make sure you have unreconcile layers,

Or disable the check.

 

Sorry, perhaps i am to old or i didn't understood, but the life is to short for headache.

Sebastian

0 Likes

natasha.l
Alumni
Alumni

Hello @Anonymous, 

 

Thanks for posting. What application are you using? 

 

It seems you need to reconcile layers, take a look at To Reconcile New Layers in the Drawing or How to turn off the unreconciled layers notification in AutoCAD. 

 

Please "Accept Solution" if a reply or replies have helped resolve the issue or answered your question, to help others in the community.

0 Likes

pendean
Community Legend
Community Legend
Are you trying to write a LISP or Script or Macro? Post your full code please., lets all have a look at what you are trying to program and resolve.

Otherwise I'm not sure why you are typing -LAYER etc. to get somewhere you can click on a pop-up to resolve. Your replies remain unclear over here.

TIA

0 Likes

Anonymous
Not applicable

Up till ten minutes ago I had a long reply clarifying my question only to realize my ORIGINAL question was overlooked or just not acknowledged.   You are right, my starting post was disjointed but no more than the thousands of other correspondences in forums.autodesk threads.  I guess it just got lost in the clutter.

 

Every thing you and others mentioned, although I'm thankful for your efforts, have already been hashed out for over a decade with unsatisfactory results.   As much as I wanted to keep the script simple and to the sys-var.'s at hand, that's just not going to happen.   (maybe with v2019/v2020)

 

The fact was driven home with the following thread:  https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/unreconciled-layer/m-p/7512785#M3610... which in turn offered up this link: https://www.theswamp.org/index.php?topic=50448.0

 

To sum up,

No, to any system variable holding a Boolean or bit code flag for layer reconcile status.

Yes, to an uneasily-reached flag using lisp 

 

sorry for the headache

b

 

0 Likes

cadffm
Consultant
Consultant

I still do not understand where your problem is,
You knowing about the commands an variables,

you have access to the help[F1],

you have the simple idea of me above and yet you are not satisfied?

 

Please write down completely why I (and the others) could not help you,
what's your problem, what are you trying, why is not it?

 

One Note:

it just boils down to getting -LAYER E * to run without catching on a dwq thats clean of any unreconciled layers.

i.e.

-LAYER
Current layer:  "0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]: E
No unreconciled layers in drawing.
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]: *
Invalid option keyword.
; error: Function cancelled

This error at the end is an LISP-error, and there is a not well written part

a) the part who send the command, because it doesn't check the current reconcile settings)

b) the missing/not well working error handler at this time.

 

Sebastian

0 Likes

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

it just boils down to getting -LAYER E * to run without catching on a dwq thats clean of any unreconciled layers.

....


 

If there are no unreconciled Layer(s), after you give it the rEconcile option, the prompt goes back to the standard Layer sub-prompt.  But if there are, the prompt is different, and you can make use of that difference.  Try this [minimally tested]:

(defun C:RecAllLay () ; <-- call it something different if you prefer
(command "_.layer" "_rEconcile"); [leaves you in the command]
(if (wcmatch (getvar 'lastprompt) "*list*"); is it the prompt for when there are some?
(command "*" ""); then [feed in the * and "" to end the Layer command]
(command ""); else [feed in only the closing ""]
); if
(princ)
); defun

You could choose something else if you prefer to check for, in place of "*list*" above -- anything that occurs in the prompt for Layers to rEconcile when there are any, but not  in the basic Layer sub-prompt that comes back when there are not.

 

EDIT:  Now I'm all confused....  I originally had "*name*" in place of "*list*" above, and it worked when I tested that.  But then I noticed what I had missed, that the Rename option in the basic Layer sub-prompt includes that.  So I changed it to "*list*" because that's not in the basic sub-prompt, and tried again, and now it doesn't seem to work.  Somehow this approach should work, but it seems I've missed somethingEDIT more:  Now I think I had done something wrong in making some new un-Reconciled Layers, and when I did that right, it did work.  But I'm still confused about its having worked right with *name* in there before, when even in the basic sub-prompt it should have seen that content and tried to give it the * before closing, but it didn't....

Kent Cooper, AIA

Anonymous
Not applicable

RecAllLay -- this I'll want to try out.  It appeals because it doesn't require drilling down thru the entity/table trees that Lee Mac's (unreconlayers) function does.  I will let you know how it shakes out after the holiday week.  

 

I got a list of threads going from 2005 to 2017 discussing this problem.  None ever mention using lastprompt.  Did you write this up recently or did I miss a talk session? 

 

b

0 Likes

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

I got a list of threads going from 2005 to 2017 discussing this problem.  None ever mention using lastprompt.  Did you write this up recently or did I miss a talk session? ....


 

I just wrote that yesterday.  The idea  had occurred to me some time ago, but I hadn't done anything with it until the question was revived.

Kent Cooper, AIA

Anonymous
Not applicable

Pendean,

Below are the eight key lines from scripts (*.scr) frequently used in my office.
They are the recommendations of MANY threads on autodesk and other forums.
.
..
...
(setq xx(getvar "LAYERNOTIFY"))
(setvar "LAYERNOTIFY" 0)
(setvar "LAYEREVALCTL" 0)
(setvar "LAYEREVAL" 0)
(COMMAND ".LAYER" "E" "*" "")
(setvar "LAYEREVALCTL" 1)
(setvar "LAYEREVAL" 1)
(setvar "LAYERNOTIFY" 1)
...
..
.
Every script permutation has been tried. The results of which has been that command line text dump.  I can't distill the problem down any further without being long-winded; which I already feel I've been.

 

As best as I understand it, those system variables mediate REACTIONs to the test of the presence of layers reconciled/unreconciled.
None of them keep the score of the ACTUAL test. If there is such a (getvar "unreconciled-layer-exists") = t/nil, its not showing up in [F1].

(Wouldn't be the first time a useful tool sat around undocumented.)

 

The closest solution from Theswamp -- (unreconlayers)(see link, my earlier reply) gets the job done but really wanted to avoid sidestepping into such a function. An even slicker one arrived from a reply today. It uses (getvar 'lastprompt). <--totally forgot that existed. I think it can be whittled down even leaner and going to test the next couple days.

 

If there's a more elegent solution up your sleeve, you got my full attention.
regards
b

0 Likes

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

..... An even slicker one arrived from a reply today. It uses (getvar 'lastprompt). .... going to test the next couple days.

....


 

So now it's not  working again for me, which makes me wonder what I did differently when it seemed like it did  work.  It works when there are no  unreconciled Layers, but when there are, it doesn't feed in the * to reconcile them all, but only the "" Enter.  So I put in a what's-the-last-prompt-really variable:

(defun C:RAL () ; = Reconcile All Layers
  (command "_.layer" "_rEconcile")
  (if (wcmatch (setq test (getvar 'lastprompt)) "*list*")
    (command "*" ""); then
(command ""); else ); if (princ) ); defun

 

and when I check what that got, it's the latest basic one, including the rEconcile option that the routine gave it:


  Command: !test
  "Enter an option [?/Make/.../Xref]: _rEconcile"

 

 

And yet, by that point in the command, the name-Layers-to-reconcile prompt must have  "arrived."  I guess I don't understand exactly what the LASTPROMPT System Variable does.  Help says:
    This string is identical to the last line seen at the Command prompt and includes any user input.

the end of which explains the rEconcile option that the routine fed in being shown there.  But the command-line history shows:

 

Command: RAL
_.layer
Current layer:  "0"
Enter an option [?/Make/.../Xref]: _rEconcile
Enter name list of layer(s) to turn reconcile or <select objects> or [?]:

  [this would be where the routine is checking for the LastPrompt, but it's feeding in  "" instead of what it should: "*" followed by  ""]
No unreconciled layers selected.
Enter an option [?/Make...

 

which indicates that the blue part has  been "seen at the Command prompt," because it's the Enter fed in, in response to that, that's causing the line under that.  But somehow (getvar 'lastprompt) is not  seeing it that way, but is recognizing the next-to-last prompt instead.

 

I imagine there's a way to get it to "see" the right one, but I haven't found it yet.  Maybe it has something to do with the nil return from the first (command) function, but I don't think so, because if I just do this manually:

  (command "_.layer" "_rEconcile")

the nil return doesn't affect anything, but it just repeats the prompt:

 

Command: (command "_.layer" "_rEconcile")
_.layer
Current layer:  "0"
Enter an option [?/Make/.../Xref]: _rEconcile
Enter name list of layer(s) to turn reconcile or <select objects> or [?]: nil

Enter name list of layer(s) to turn reconcile or <select objects> or [?]:

Kent Cooper, AIA
0 Likes

Kent1Cooper
Consultant
Consultant

All right -- I think I've got it.  In testing [but others please test, too], I find that the message that there are no unreconciled Layers does  get recognized as the last prompt [why the prompt asking for names when there are  unreconciled Layers does not, I couldn't say*].  So we turn it around from the check in my previous routine, and check for that none-to-do message instead, with the 'then' argument being just to close the Layer command, and the 'else' argument being to ask for all to be reconciled and then close it.

 

(defun C:RAL () ; = Reconcile All Layers
  (command "_.layer" "_rEconcile")
  (if (= (getvar 'lastprompt) "No unreconciled layers in drawing.")
    (command ""); then - end Layer command
    (command "*" ""); else - rEconcile all, then end
  ); if
  (princ)
); defun

 

*EDIT:  Maybe the difference is that the message this checks for is "complete" without any User input.  In the other approach, since there's a prompt waiting for  User input, and the LASTPROMPT System Variable stores the last one including User input, perhaps it doesn't "register" to be considered the last prompt until after  User input has been supplied in response to it.

Kent Cooper, AIA
0 Likes

cadffm
Consultant
Consultant

@Anonymous 

I do not understand why you whant to do that (what your 8 lines do), but you didn't answer my questions, so i am out.

If you like to have a pain with the program, it's your choice to hear all helpful things or just a part.

 

 

 

 

@Kent1Cooper - take the other answer a indicator.

 

(defun C:RAL () ; = Reconcile All Layers
(command "_.layer" "_rEconcile")
(if (wcmatch (setq test (getvar 'lastprompt)) "Keine*,No*")
(command ""); then
(command "*" ""); else
); if
(princ)
); defun

Sebastian

0 Likes

cadffm
Consultant
Consultant

@Kent1Cooper  wrote

LOL, Two people a thought. I was just AFK between writing and posting. rofl.

Sebastian

0 Likes

Anonymous
Not applicable

Sebastian

!!!? My apologies!  I thought I was answering you!  Got you mixed with Pendean.  All this correspondence I've been doing on a small laptop apart from my cad station.   I meant no slight.

The reply starting with "Up till ten minutes ago..."  And the following, I meant to send to you but since this is an open forum, it is by extension, to all.

 

Below are the eight key lines from scripts (*.scr) frequently used in my office.
They are the recommendations of MANY threads on autodesk and other forums.
.
..
...
(setq xx(getvar "LAYERNOTIFY"))
(setvar "LAYERNOTIFY" 0)
(setvar "LAYEREVALCTL" 0)
(setvar "LAYEREVAL" 0)
(COMMAND ".LAYER" "E" "*" "")
(setvar "LAYEREVALCTL" 1)
(setvar "LAYEREVAL" 1)
(setvar "LAYERNOTIFY" 1)
...
..
.
      Every script permutation has been tried. The results of which has been that command line text dump.  I can't distill the problem down any further without being long-winded; which I already feel I've been.

      As best as I understand it, those system variables mediate REACTIONs to the test of the presence of layers reconciled/unreconciled.
None of them keep the score of the ACTUAL test. If there is such a (getvar "unreconciled-layer-exists") = t/nil, its not showing up in [F1].

(Wouldn't be the first time a useful tool sat around undocumented.)

     The closest solution from Theswamp -- (unreconlayers)(see link, my earlier reply) gets the job done but really wanted to avoid sidestepping into such a function. An even slicker one arrived from a reply today. It uses (getvar 'lastprompt). <--totally forgot that existed. I think it can be whittled down even leaner and going to test the next couple days.

 

If there's a more elegent solution up your sleeve, you got my full attention.
regards
b

 

Since I hit send on that correspondence,  I did 4 tests on Kent1coopers solution and only one ran to the end.  The code looked like a slam-dunk but now I'm not sure why that even one ran successively.  It may be just a matter of a hidden space in the syntax.  Might have to fall back to LM's.

 

 

0 Likes

cadffm
Consultant
Consultant

@Anonymous 

thank you for the answer, forget my PM

 

 

Half as bad. It's only occasionally frustrating if you can not express yourself enough (foreign language) and you thinking other one ignores you.

In Short:
>"None of them keep the score of the ACTUAL test. "
Yes


And now: Code from #14 or my from #15 should work for you.

 

But my Question, all the time, is unanswered: WHY DO YOU DO THAT?

"THAT" 1 = the Lisp "RAL" do.
"THAT" 2 = your Script (try to) do.

Why do you try to reconcile unreconciled layers by a *.scr

offtopic:
And why do you use these simple lisp function in your *.scr file? setvar, command


LT Users can not use a program extension, so they have to go the way of my hint in #4 from friday,
make sure ther is an unrec.Layer.
;;SCR
_.LAYER
_new
unrecornotunrec
_E
*

_.PURGE
_layer
unrecornotunrec
_no
;;END

Sebastian

0 Likes

Anonymous
Not applicable

I just ran the revised function, but on two real short dwg lists.  Both successes. Still want to try a long unsupervised batch on a couple stations.  See what the results are in the morning.  If it runs consistent, there's a half a dozen other scripts and lisp functions that could use it here.

 

b

0 Likes

cadffm
Consultant
Consultant

You don't need the test with long file lists, there are only 2 possibilities, so a list with 2 files

with guaranteed once unreconc. layer and once only reconc. layers are more  meaningful

as a list of 1000 files where this is not known.

 

 

"...See what the results are in the morning. "

and perhaps i get an answer to my question 'why do you do that'?

 

Why do you want to use(set on) the (un)reconcile feature, but set all layer unproofed to 'reconciled'?

That's sounds strange an not senseful, also the the setting Layernotify=1. Is it really the (only) best time to check new layers?

hmm

 

THX and bye

Sebastian

0 Likes