TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MvdP on August 15, 2006, 04:45:48 AM
-
Is it possible to bypass the group command in the follwing part of my routine when i am in a refedit.(** GROUP command not allowed during reference editing **)
(defun h1 ()
(command "LAYER" "on" "z-arc" "")
(command "bhatch" "p" pat sca hk0 "s" "L" "" "")
(setq arcering (entlast))
(setq ed (entget arcering))
(setq ed (subst (cons 8 "00---0-a_Arceer") (assoc 8 ed) ed ))
(entmod ed)
(setq groepgetal (rtos (getvar "CDATE") 2 9))
(setq groepnaam (substr groepgetal 10 9))
(if (= arcx nil)
(progn
(command "-group" "c" groepnaam "" arcering omranding "")
)
)
(command "layer" "off" "z-arc" "")
(setq c (entlast))
(command "draworder" c "" "back")
)
-
You could check for CMDACTIVE? Won't be specifically REFEDIT, but if a command is active, skip the "group".
-
Thanks CADaver this is what i did.
;hatches the poly-line
(defun h1 ()
(command "LAYER" "on" "z-arc" "")
(command "bhatch" "p" pat sca hk0 "s" "L" "" "")
(setq arcering (entlast))
(setq ed (entget arcering))
(setq ed (subst (cons 8 "00---0-a_Arceer") (assoc 8 ed) ed ))
(entmod ed)
(setq groepgetal (rtos (getvar "CDATE") 2 9))
(setq groepnaam (substr groepgetal 10 9))
(if (= arcx nil)
(progn
(command "-group" "c" groepnaam "" arcering omranding "")(while ( =1 (getvar "CMDACTIVE")))
)
)
(command "layer" "off" "z-arc" "")
(setq c (entlast))
(command "draworder" c "" "back")
)
But it doesn't skip the group command what am i doing wrong here.?
-
Nobody.?
-
Where is the value for this being set ..
(if (= arcx nil)
....
NB: could use this
(if (not ARCX)
....
<standard code failure fixer 6A> make the variables local,
what happens then ...
... don't have time to look at your real problem ..
.. but, can you explain how you believe this works ..
(progn
(command "-group" "c" groepnaam "" arcering omranding "")(while ( =1 (getvar "CMDACTIVE")))
)
-
.. but, can you explain how you believe this works ..
(progn
(command "-group" "c" groepnaam "" arcering omranding "")(while ( =1 (getvar "CMDACTIVE")))
)
No i can't explain it.That is why i am asking how to do this so it will work.
(arcx is not being set it.this line is unnecessary.And i took it out.!!)
-
If you bother to test it, the CMDACTIVE variable is still 0 when Refedit is active.
-
I did bother to test it.
So does this mean my question is impossible to achieve.
-
(command "LAYER" "on" "z-arc" "")
Why are you turning this ON, or do you want it current ? you appear to NOT use the Layer.
(command "bhatch" "p" pat sca hk0 "s" "L" "" "")
what are the values for the variables passed to the bhatch command
Note that the conventional call is "-BHATCH" <with a hyphen> to ensure supression of the dialog,
similarly for "-LAYER"
omranding
What is the value of this variable ?
-
Let me try to explain what this routine is doing.
It asks to select two lines and than the routine creates a boundary on layer z-arc hatches the boundary with a pattern (defined in button) and create a group of the two objects.So when i pick the hatch or boundary the complete group is deleted.
This is working perfect but when in refedit autocad cannot create a group and returns an error.So that is why i am asking if it possible to skip the make group command when in refedit. If it is not possible to detect this somehow i have to found another way.And i think the easiest way is to leave the make group command out of this routine
-
(getvar "refeditname")
""
or
the name of the reference being edited
-
Ok but to do when refedit can be any block.?And where do i put it in this.?
This what i did but it aint working.
(setq refname (getvar "refeditname"))(while (<> refname nil ))(command "-group" "c" groepnaam "" arcering omranding "")
-
You could try something like :
(IF
(= (STRLEN (GETVAR "refeditname")) 0)
(COMMAND "-group" "c"
groepnaam ""
arcering omranding
""
)
)
-
Another question? What is setting this: omranding variable. If it's empty or nil, can the command still work? Also, is there any reason that the layer z-arc wouldn't exist? Just a thought here, but if it didn't exist, turning it one would merely crash your routine from the start. Just to be clear, you might consider using (layer make z-arc), then turning it on and making sure it's thawed and unlocked. Using make will either create it if it doesn't exist and set it as the current layer, or just set it as the current layer if it does already exist. If you don't wish to have it set as the current layer, you should still employ the above to make sure all possible issues are resolved, then set the desired layer. As for the real problem, do you want to test for refname NOT nil, meaning you're in a refedit command, or (refname nil)? Also, and maybe this is me getting here late, but why are you using while here?
-
Kerry.
I tried your code and it not skipping the group command.
Daron.
You have a lot of guestions and remarks, and i can you tell you that the whole routine is working except the skipping part.And the answer for the last question is the following.I want the routine to skip the making of a group when i am in a refedit no mather what block i am editing.And how to do this i don't know.
-
What does this give you .. in each case ??
(IF
(= (STRLEN (GETVAR "refeditname")) 0)
(alert "No Refedit running")
;;
;; else
(alert "Refedit active")
)
-
It gives me what it is supposed to give me in each case.
-
good. Past my time for bed.
-
Kerry.
I tried your code and it not skipping the group command.
Daron.
You have a lot of guestions and remarks, and i can you tell you that the whole routine is working except the skipping part.And the answer for the last question is the following.I want the routine to skip the making of a group when i am in a refedit no mather what block i am editing.And how to do this i don't know.
Well, it looks like Kerry is more than willing and capable of getting your problem solved. Of course, your patience in his questions will teach you a lot. When you get that part resolved, you might consider the idea that just because it works, doesn't mean it always will. Eventually, someone will purge that layer you turn on and you'll pull one of these -> :pissed: :realmad: <- because you can't figure out why it no longer works.
-
Thanks for all the help got it working and yes i am learning a lot in the Swamp.