Search found 58 matches
- Tue Aug 09, 2016 9:50 am
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
I'm wondering if there is any way to temporarily cancel the listener. There are occasions where the app itself has to make changes to the entities and in such occasions it may not make sense to track these changes. I reckon its this: removeTransactionListener() So, I suppose I suppose I will have to...
- Mon Aug 08, 2016 5:36 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
Your recomendation has been taken to heart, and the necessary adaptations have been done so my app doesn't implode when Qcad receives an update. Anyone who looks at my code now will probably be induced in error and think I actually know what I'm doing!
Thank you, andrew.
Thank you, andrew.
- Mon Aug 08, 2016 2:07 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
getAffectedObjects() provides a list of entities that have been changed. getPropertyChanges(vl_objIds ) provides a list of changes on that particular entity, the Id of THE CHANGE is provided by: test3 = vl_change_list .getPropertyTypeId(); test4 = test3.getId(); Each type of change has an ID associa...
- Mon Aug 08, 2016 12:38 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
Is there any list of the modification Id's that we can peruse?
It's kind of annoying to use the debugger to individually test for them =P
Thank you.
It's kind of annoying to use the debugger to individually test for them =P
Thank you.
- Mon Aug 08, 2016 11:11 am
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
Just to hammer it down for those who are searching for a code example: // create a new transaction listener: AutoRefresh = new RTransactionListenerAdapter(); //Considers every alteration appWin.addTransactionListener(AutoRefresh); //Will be called whenever there is a change in objects AutoRefresh.tr...
- Mon Aug 08, 2016 10:58 am
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
I'm stumped... so I made 3 tests that went to hell, but i required components of two of them to make it happen!
That's awesome.
Well, now I got it running. Thank you, andrew.
That's awesome.
Well, now I got it running. Thank you, andrew.
- Mon Aug 08, 2016 10:10 am
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
Parsing strings to fetch information is certainly not the recommended way to retrieve any information from entities, document, transactions, etc. These output strings you are using are meant for debugging only and can change significantly in any future update which means your code will break. Thank...
- Fri Aug 05, 2016 4:55 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
On the same line of thought. I noticed that the getPropertyChanged that I used on the example on my last post did not seem to tell me which color it was changed to, and changed from. Is there any way to receive that information through this process we were discussing? Or does this method do that alr...
- Fri Aug 05, 2016 2:55 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
So let's see. As a simple test I did: AutoRefresh.transactionUpdated.connect(function(document, vl_changes) { if (isNull(document) || isNull(vl_changes)) { return; } vl_objIds = vl_changes.getAffectedObjects(); //Since vl_objIds gets me the id of the changed entity anyway I use it to get the specifi...
- Fri Aug 05, 2016 11:58 am
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
Just wondering if there is any manner of flag in this process that is activated according to the type of change that is made on an entity. For example, RTransactionListenerAdapter indicates that a change occured, and some other listener additionally informs that the change was in the color of the en...
- Thu Aug 04, 2016 4:28 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: [Solved]Get entity based on ID
- Replies: 4
- Views: 7739
Re: Get entity based on ID
RTransaction::getAffectedObjects returns a list of object IDs as integers ( RObject::Id ) not strings.] Correct once again, andrew. I failed to see the "vl_change_list= vl_objIds.toString();" on my own code. Gonna do some testing, but I suppose this is all I'll need for now. Thank you so very much,...
- Thu Aug 04, 2016 4:18 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
Thank you, andrew. Btw, I believe it's also relevant to mention that the listener is changed when an entity is added, deleted AND when the points are changed. Example: Existing line from 0:0 to 0;10. Same entity is changed to 10;0 to 0;10. Listener activated. Just is case anybody was wondering. Than...
- Thu Aug 04, 2016 4:07 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: [Solved]Get entity based on ID
- Replies: 4
- Views: 7739
Re: Get entity based on ID
Entity_to_text(entity); simply takes the Id of the entity and returns it as a string. Since I'll have to compare it with other sources that mostly work as strings. function Entity_to_text(entity){ var Entity_ID; Entity_ID = entity.getId(); Entity_ID = Entity_ID.toString(); return Entity_ID; } vl_obj...
- Thu Aug 04, 2016 3:42 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: [Solved]Get entity based on ID
- Replies: 4
- Views: 7739
[Solved]Get entity based on ID
I will continue using transaction then. Thank you. Regarding the second question. Example: entityIds = doc.queryAllVisibleEntities(); for (i = 0; i < entityIds.length; i++) { entity = doc.queryEntity(entityIds[i]); Entity_ID = Entity_to_text(entity); if (Entity_ID == custom_ID){ //Does stuff break; ...
- Thu Aug 04, 2016 3:28 pm
- Forum: QCAD Programming, Script Programming and Contributing
- Topic: Reacting to document modifications
- Replies: 22
- Views: 22527
Re: Reacting to document modifications
Apologies, you are absolutely correct. And yes, my example with the transaction method works perfectly. I just wanted to limit it only to changes in entities. The example is the same, but with; AutoRefresh = new REntityExportListenerAdapter(); //Considera alterações às entidades appWin.addEntityExpo...