Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Please Help me! att & csv matching Lisp

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
uycho5066
474 Views, 6 Replies

Please Help me! att & csv matching Lisp

admire your ability and need your help.

First and foremost, please understand that my English skills are not proficient.

 

Some modifications are necessary in the CSV LISP program that you have created.

 

The structure is that when the value of "TAG-ID" in the attribute block matches the value in the CSV file, the remaining values of "HP", "VOLTAGE", and "PHASE" are updated.

 

What I want to do is to update the values of "HP", "VOLTAGE", and "PHASE" only when both "TAG-ID1" and "TAG-ID2" match.

 

Please Help me Sir!

Tags (2)
6 REPLIES 6
Message 2 of 7
paullimapa
in reply to: uycho5066

I just changed one line in the code...

From this:

(setq CSVMatch (mapcar 'cdr (mapcar (lambda (pair) (if (member (car pair) tagID) pair)) data)))

To this:

(setq CSVMatch (cdr(car(vl-remove-if 'null (mapcar 'cdr (mapcar '(lambda (pair) (if (member (car pair) (car tagID)) pair)) data))))))

seems to work after that.

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 7
uycho5066
in reply to: uycho5066

Thank you sir!!! Very AWESOME

Message 4 of 7
uycho5066
in reply to: paullimapa

Thank you sir!!! Very AWESOME

Message 5 of 7
paullimapa
in reply to: uycho5066

you're very welcome...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 6 of 7
uycho5066
in reply to: paullimapa

There was a misunderstanding regarding my request.

 

The method I wanted to implement was that the function would only work when both "TAG-ID1" and "TAG-ID2" attribute values are met. However, the method you have "HP", "VOLTAGE", "PHASE" changes when only one of the two is met.

 

Please let me know the solution.

Message 7 of 7
paullimapa
in reply to: uycho5066

O yes, I forgot about that.

Ok, replace the following lines of code:

			(setq CSVMatch (cdr(car(vl-remove-if 'null (mapcar 'cdr (mapcar '(lambda (pair) (if (member (car pair) (car tagID)) pair)) data))))))
		        (foreach itm (mapcar 'cons '("HP" "VOLTAGE" "PHASE") CSVMatch)
		          (if (setq f (assoc (Car itm) attv))
			    	(vla-put-textstring (caddr f) (cdr itm))))

With these lines:

			(setq CSVMatch (cdr(car(vl-remove-if 'null (mapcar 'cdr (mapcar '(lambda (pair) (if (and(member (car pair) (car tagID))(member (cadr pair) (cadr tagID))) pair)) data))))))         
       (if CSVMatch
		        (foreach itm (mapcar 'cons '("HP" "VOLTAGE" "PHASE") CSVMatch)
		          (if (setq f (assoc (Car itm) attv))
			    	(vla-put-textstring (caddr f) (cdr itm))))
       )

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report