Jump to content

Recommended Posts

Posted (edited)

I'm trying change some parameters in a spline, for example make it closed.

For that I need to set bit 1 in group 70

So far I got this:

(defun c:test (/ ent entg entgNew flags) 
    (setq ent (SSGET "_:S" '((0 . "SPLINE"))))
    (setq ent (cond (ent (SSNAME ent 0)) (T nil)))
    (if ent 
        (progn 
            (SSSETFIRST nil (SSADD ent))
            (setq entg    (entget ent)
                  flags   (cdr (assoc 70 entg))
                  entgNew (subst (cons 70 (logior flags 1)) (assoc 70 entg) entg)
            )
            (entmod entgNew)
            (print entgNew)
            (print (entget ent))
        )
    )
    (princ)
)

It seems to correctly modify the group 70, but the actual spline not being modified.

Is it something I'm doing wrong?

Thank you.

Edited by vanowm
Posted

Is more easy with vlax

(defun c:test ( / ss obj)
	(setq ss (SSGET "_:S" '((0 . "SPLINE"))))
	(cond
		(ss
			(setq obj (vlax-ename->vla-object (ssname ss 0)))
			(vlax-put obj 'Closed2 1)
		)
	)
	(prin1)
)

 

Posted

Thanks.

But any ideas why entmod doesn't work?

Posted

Because the vertex and bulge change when the spline is closed.

For exemple for the same simple spline (3 vertex) opened then closed:

OPEN

(0 . "SPLINE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbSpline")
(210 0.0 0.0 1.0)
(70 . 1064)
(71 . 3)
(72 . 9)
(73 . 5)
(74 . 3)
(42 . 1.0e-09)
(43 . 1.0e-10)
(44 . 1.0e-10)
(40 . 0.0)
(40 . 0.0)
(40 . 0.0)
(40 . 0.0)
(40 . 3.83172)
(40 . 9.42901)
(40 . 9.42901)
(40 . 9.42901)
(40 . 9.42901)
(10 17.2262 14.074 0.0)
(10 16.5098 15.5332 0.0)
(10 14.7467 19.124 0.0)
(10 19.0981 18.359 0.0)
(10 21.6812 17.9049 0.0)
(11 17.2262 14.074 0.0)
(11 16.0866 17.7323 0.0)
(11 21.6812 17.9049 0.0)

CLOSE

(0 . "SPLINE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbSpline")
(210 0.0 0.0 1.0)
(70 . 3115)
(71 . 3)
(72 . 10)
(73 . 6)
(74 . 0)
(42 . 1.0e-09)
(43 . 1.0e-10)
(40 . 0.0)
(40 . 0.0)
(40 . 0.0)
(40 . 0.0)
(40 . 3.83172)
(40 . 9.42901)
(40 . 15.3046)
(40 . 15.3046)
(40 . 15.3046)
(40 . 15.3046)
(10 17.2262 14.074 0.0)
(10 16.0139 14.5276 0.0)
(10 14.4162 19.5184 0.0)
(10 25.3006 19.2494 0.0)
(10 19.0853 13.3785 0.0)
(10 17.2262 14.074 0.0)

 

Posted

Honestly - I attempted at one time to make code for altering splines with (entmake), trying to account for all the changes. I failed miserably! Using the activeX methods and properties are MUCH easier.

  • Like 1
Posted
21 hours ago, vanowm said:

It seems to correctly modify the group 70, but the actual spline not being modified.

Is it something I'm doing wrong?

Thank you.

 

Did you issue a regen command and it still didn't update?

Posted (edited)
1 hour ago, mhupp said:

Did you issue a regen command and it still didn't update?

I don't know about the OP, but I tried that and it didn't work. I also tried using (entupd) and that also doesn't change it even thought the actual entity list shows the changed values. Also, if you use the properties pallet and update the closed status, it updates everything correctly.

Edited by pkenewell
  • Like 1
Posted (edited)
On 4/21/2024 at 10:07 PM, Tsuky said:

Because the vertex and bulge change when the spline is closed.

It makes sense. Also note, that your "closed" spline got "periodic" flag enabled. This removed all fit points from it. This is actually was the reason I started messing with this, because whenever I closed one spline, I'd lose access to fit points even though it still showed as "fit" spline. So, I did entmod on it to reset that flag and it worked! But later I've decided play with other flags in group 70 and it just didn't want to work...

 

My guess is when you change "close" parameter from the properties pallet, it adds last fit point the same as the first one, not just changing the flag. 

 

[EDIT]

Another thing I just noticed that the flag may not be corresponding with what it shows in the properties pallet. For example my spline has group 70 of 1067, which translates into: closed, periodic, planar

however properties pallet shows it's not periodic.

spline.dwg

Edited by vanowm

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...