Error boundary Xline

Error boundary Xline

martin_leiter
Advocate Advocate
2,167 Views
23 Replies
Message 1 of 24

Error boundary Xline

martin_leiter
Advocate
Advocate

Please help.
I have the following Lisp:

(defun c:umgrxlinien (/ AWS)
(setvar "HPISLANDDETECTIONMODE" 0)
(setvar "HPISLANDDETECTION" 2)
(if(setq AWS(ssget "X"
'( (-4 . "<OR")
(0 . "XLINE")
(0 . "Ray")
(-4 . "OR>")
)
))
(command-s "-umgrenzung" "o" "U" "N" AWS "" "" "_non" Pause))
(princ)
)

The error only occurs in Acad 2025. In Acad 2024 everything works normally and a boundary is created within the Xlines.

In 2025, however, if a line crosses the boundary of the Xlines, only the part up to this line is recognized as a boundary.
I have tried many things but nothing works.
Can someone help?
Thanks

Martin

0 Likes
Accepted solutions (1)
2,168 Views
23 Replies
Replies (23)
Message 2 of 24

Kent1Cooper
Consultant
Consultant

@martin_leiter wrote:

....

(command-s "-umgrenzung" "o" "U" "N" AWS "" "" "_non" Pause))
....


Spell out for us what those option letters stand for in the apparently German version.

Kent Cooper, AIA
0 Likes
Message 3 of 24

Moshe-A
Mentor
Mentor

@martin_leiter hi,

 

if i understand you it is about BHATCH inside XLINES or RAYS

(command-s "-umgrenzung" "o" "U" "N" AWS "" "" "_non" Pause)

 

maybe the last 2 arguments are redundant? cause we assume after selecting objects we are done.

 

btw, when using (command-s) function,  you need not to be worry about the command arguments cause it will pause for your inputs until command is done, only then the execution will move to the next expression\call.

 

Moshe

 

0 Likes
Message 4 of 24

martin_leiter
Advocate
Advocate

Hello Moshe-A,
Thanks for your help.
Unfortunately, that doesn't work either.
The selection is recognized and also specified in the command line. But it seems as if the selection is not recognized during the point analysis.
The only strange thing is that when I execute the integrated command via the Draw-Boundary tab, the Xlines are recognized and the boundary is created correctly.
As I said, the problem has only existed since acad 2025.

Martin

0 Likes
Message 5 of 24

Moshe-A
Mentor
Mentor

@martin_leiter ,

 

check this one 😀

you need to take care of hatch scale.

 

Moshe

 


 

 

 

(defun c:MyBHatch (/ AWS)
 (setvar "HPISLANDDETECTIONMODE" 0)
 (setvar "HPISLANDDETECTION" 2)
  
 (if (setq AWS (ssget "X" '((-4 . "<OR") (0 . "XLINE") (0 . "Ray") (-4 . "OR>"))))
  ; (command-s "-umgrenzung" "o" "U" "N" AWS "" "" "_non" Pause)\
  (command-s "._bhatch"
             "_A"	; Advanced
             "_B"	; Boundary set
             "_N"       ; New 
             "_si"      ; single selection
             AWS        ; have my selection
             ""  	; continue
             pause	; pick analysis point
             "")	; finish
 )
  
 (princ)
)

 

 

0 Likes
Message 6 of 24

martin_leiter
Advocate
Advocate

Hello Moshe-A

Thanks for the help.
Yes, with the hatching it works as you wrote.
But I just want to create a border without hatching.
That doesn't work with acad 2025.
I only set the system variables at the beginning because I thought they would be involved.
But that doesn't seem to be the case.

Best wishes
Martin

0 Likes
Message 7 of 24

Moshe-A
Mentor
Mentor

@martin_leiter ,

 

that's very easy to implement 😀

 

 

(defun c:MyBPoly (/ aws)
 ;(setvar "HPISLANDDETECTIONMODE" 0)
 ;(setvar "HPISLANDDETECTION" 2)
  
 (if (setq aws (ssget "X" '((-4 . "<OR") (0 . "XLINE") (0 . "Ray") (-4 . "OR>"))))
  ; (command-s "-umgrenzung" "o" "U" "N" AWS "" "" "_non" Pause)\
  ; (command-s "._bhatch"
  (command-s "._boundary"
             "_A"	; Advanced
             "_B"	; Boundary set
             "_N"       ; New 
             "_si"      ; single selection
             aws        ; have my selection
             ""  	; continue
             pause	; pick analysis point
             "")	; finish
 )
  
 (princ)
)

@@ 

0 Likes
Message 8 of 24

martin_leiter
Advocate
Advocate

Hello Moshe-A

I ran your Lisp.

Unfortunately the border is not recognized correctly.

See picture

Kind regards

Martin

0 Likes
Message 9 of 24

martin_leiter
Advocate
Advocate

One possibility might be to use the Lisp with the hatching
but first activate the setting for the hatching "Create border".
Then create the hatching with the border and then delete the hatching without the border.
You would then also have to deactivate the setting for the hatching options "Create border".
This would give you the border.
Would that be possible?
What do you think?

Best wishes

Martin

0 Likes
Message 10 of 24

Moshe-A
Mentor
Mentor

@martin_leiter 

 

In the (ssget) call you filter out all objects except for xlines and rays. now you say i also want a polyline 🤔

OK i added polyline.

 

works?

 

 

(defun c:MyBPoly (/ aws)
 ;(setvar "HPISLANDDETECTIONMODE" 0)
 ;(setvar "HPISLANDDETECTION" 2)
  
 (if (setq aws (ssget "X" '((-4 . "<OR") (0 . "XLINE") (0 . "Ray") (0 . "LWPOLYLINE") (-4 . "OR>"))))
  ; (command-s "-umgrenzung" "o" "U" "N" AWS "" "" "_non" Pause)
  ; (command-s "._bhatch"
  (command-s "._boundary"
             "_A"	; Advanced
             "_B"	; Boundary set
             "_N"       ; New 
             "_si"      ; single selection
             aws        ; have my selection
             ""  	; continue
             pause	; pick analysis point
             "")	; finish
 )
  
 (princ)
)

 

 

 

0 Likes
Message 11 of 24

martin_leiter
Advocate
Advocate

Hello Moshe-A

Have you seen my picture?

Unfortunately, this doesn't work in Autocad 2025.
The preselected boundaries (Xlines) are ignored when using the boundary command.

This is the case with Lisp and it is also the case when I enter the boundary command in the command line.

It only works with the Acad command if you activate it via the "Draw" "Boundary" tab.

Please excuse me if I cause such trouble.

Martin

0 Likes
Message 12 of 24

Moshe-A
Mentor
Mentor

@martin_leiter ,

 


@martin_leiter wrote:

Hello Moshe-A

Have you seen my picture?

Unfortunately, this doesn't work in Autocad 2025.
The preselected boundaries (Xlines) are ignored when using the boundary command.

This is the case with Lisp and it is also the case when I enter the boundary command in the command line.

It only works with the Acad command if you activate it via the "Draw" "Boundary" tab.

Please excuse me if I cause such trouble.

Martin


did i see your picture? well, how did i know to add the polyline to the filter???

 

take a look at my picture:

AutoCAD R2025

the red lines are xlines

the green lines are rays

the cyan box is polyline

the white is boundary generated by (c:MyBPoly)  function

 

if your AutoCAD doesn't do that then something wrong with your AutoCAD version.

check if there is an update or enter your autodesk account and check for update there.

or install an English version, but not on the same computer.

 

Moshe

 

 

0 Likes
Message 13 of 24

Kent1Cooper
Consultant
Consultant

@martin_leiter wrote:

.... the border is not recognized correctly.  See picture ....


Kent1Cooper_0-1719502423644.png

I think there's some confusion.  Am I right that what is "not recognized correctly" about the above is that with the blue Xlines selected, you do not want the purplish rectangle to be considered, but only the Xlines, and you want this green result?

Kent1Cooper_1-1719502494272.png

[Pardon my freehand.]  I think your description in Message 1 is consistent with this being the desired result [a Line crossing there, a rectangle corner infringing here].  That would mean that Polylines should not be added to the selection filtering.

Do I understand correctly?

Kent Cooper, AIA
0 Likes
Message 14 of 24

Kent1Cooper
Consultant
Consultant

@martin_leiter wrote:

.... if a line  [red below]  crosses the boundary of the Xlines  [blue] , only the part up to this line  [the green result]  is recognized as a boundary. ....


To further clarify, as I understand that description:

Kent1Cooper_1-1719506141507.png

But if the blue Xlines [or Rays] are selected as what should define the boundary, and a pick is made inside the larger area in the middle, what you want is not the green area only up to the red Line, but the white result on the right, ignoring the red Line and reading only the selected blue Xlines as bounding objects.  Is that the idea?

Kent Cooper, AIA
0 Likes
Message 15 of 24

komondormrex
Mentor
Mentor

if you are going to pick a point, why then you do not select all like this

(defun c:umgrxlinien (/ AWS)
;;;(setvar "HPISLANDDETECTIONMODE" 0)
;;;(setvar "HPISLANDDETECTION" 2)
(if(setq AWS(ssget "X"
;;;'( (-4 . "<OR")
;;;(0 . "XLINE")
;;;(0 . "Ray")
;;;(-4 . "OR>")
;;;)
))
(command-s "_.-boundary" "_a" "_i" "_y" "_b" "_n" AWS "" "" "_non" Pause ""))
(princ)
)

 or just simply pick the inside point

(defun c:umgrxlinien (/ AWS)
	(command-s "_.-boundary" "_a" "_i" "_y" "" "_non" Pause "")
	(princ)
)
0 Likes
Message 16 of 24

martin_leiter
Advocate
Advocate

Hello Kent Cooper
yes, exactly!
The white object should be the result.
The problem is Autocad 2025. As of this version, my Lisp no longer works.
It worked without problems until Acad 2025.
It would be important if someone could test it in Acad 2025.

Best regards

Martin

0 Likes
Message 17 of 24

hmsilva
Mentor
Mentor

@martin_leiter wrote:

...

The error only occurs in Acad 2025. In Acad 2024 everything works normally and a boundary is created within the Xlines.

In 2025, however, if a line crosses the boundary of the Xlines, only the part up to this line is recognized as a boundary.
I have tried many things but nothing works.
Can someone help?
Thanks

Martin


@martin_leiter unfortunately this is not a solution to the behavior of the -boundary command in AutoCAD 2025, I did test and the behavior is not the same as previous versions...

 This is just a slow workaround…

(defun c:demo (/ pt ss)
    (if	(and (setq ss (ssget "_X" '((0 . "XLINE,RAY"))))
	     (setq pt (getpoint "\nPick internal point: "))
	)
	(progn
	    (command "._IsolateObjects" ss "")
	    (bpoly pt)
	    (command "._UnIsolateObjects")
	)
    )
    (princ)
)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 18 of 24

martin_leiter
Advocate
Advocate

Thanks Henrique

yes, I thought of that too.
This is working well for now
Thanks for your help
Maybe someone else has an idea

Martin

Message 19 of 24

ВeekeeCZ
Consultant
Consultant

Have you tried this predecessor without n or with the argument of 1 or 2?

(initcommandversion n)

 

0 Likes
Message 20 of 24

hmsilva
Mentor
Mentor
Accepted solution

@martin_leiter wrote:

Thanks Henrique

yes, I thought of that too.
This is working well for now
Thanks for your help
Maybe someone else has an idea

Martin


@martin_leiter another workaround, faster than the previous one… 

 

 

 

(defun c:demo (/ new old pt ss)
    (if	(and (setq ss (ssget "_X" '((0 . "XLINE,RAY"))))
	     (setq pt (getpoint "\nPick internal point: "))
	)
	(progn
	    (setq old (entlast))
	    (command "._-bhatch" "_A" "_B" "_N" ss "" "_A" "_N" "R" "_Y" "" pt "")
	    (setq new (entlast))
	    (if	(and (not (eq old new))
		     (= (cdr (assoc 0 (entget new))) "HATCH")
		)
		(entdel new)
	    )
	)
    )
    (princ)
)

 

 

 

 

Hope this helps,
Henrique

EESignature