Jump to content

Combine vl-position with wcmatch, or member with wcmatch


Aftertouch

Recommended Posts

Hi all, got myself a tricky one...

I got a list, with an order, this is just an example.. total list is over 150 items long

(setq ordertable
		(list
			"*STONE-*"
			"*EARTH-*"
			"*PIPES-*"
		)
)

 

I got 2 symbols:

(setq enlay "TEST-STONE-NEW")
(setq enlaydouble "DEFAULT-PIPES-NEW")

 

I got a lot of double lines, i want to 'overkill' them, but keep the layer, highest in the ordertable...

So i made this code:

 

(if (< (vl-position enlay ordertable)(vl-position enlaydouble ordertable))
		(entdel enseldouble)
		(entdel ensel)
)

 

This works, when the ordertable is not having any wildcards.

I cannot get this to work, with it accepting wildcards....

Any suggestions?

 

So... i need to determine with of the 2 items to delete, based on this position in the ordertable... with usage of wildcards...

 

Thanks in advance!

 

Link to comment
Share on other sites

Perhaps!

(setq ordertable
		(list
			"*STONE-*"
			"*EARTH-*"
			"*PIPES-*"
		)
)
(setq enlay "TEST-STONE-NEW")
(setq enlaydouble "DEFAULT-PIPES-NEW")
(if
	(<
		(car (vl-remove nil (mapcar '(lambda (x) (if (wcmatch enlay x) (vl-position x ordertable))) ordertable)))
		(car (vl-remove nil (mapcar '(lambda (x) (if (wcmatch enlaydouble x) (vl-position x ordertable))) ordertable)))
	)
		(print "(entdel enseldouble)")
		(print "(entdel ensel)")
)(prin1)

 

  • Like 1
Link to comment
Share on other sites

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...