With the following function I am trying to load the model into the earlier initialized viewer.
viewer.loadModel("https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW1wbGVuaWFfaW1kL1JhaV8wNC4zZHM/manifest/urn%3Aadsk.viewing%3Afs.file%3AdXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW1wbGVuaWFfaW1kL1JhaV8wNC4zZHM%2Foutput%2FRai_04.3ds.svf")
Unfortuneately I get the following error for the function:
viewer3D.js:74844 Error while processing SVF: {"url":"https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW1wbGVuaWFfaW1kL1JhaV8wNC4zZHM/manifest/urn%253Aadsk.viewing%253Afs.file%253AdXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW1wbGVuaWFfaW1kL1JhaV8wNC4zZHM%252Foutput%252FRai_04.3ds.svf?domain=http%3A%2F%2Flocalhost%3A3002","httpStatus":400,"httpStatusText":"Bad Request","data":{"url":"https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW1wbGVuaWFfaW1kL1JhaV8wNC4zZHM/manifest/urn%253Aadsk.viewing%253Afs.file%253AdXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW1wbGVuaWFfaW1kL1JhaV8wNC4zZHM%252Foutput%252FRai_04.3ds.svf?domain=http%3A%2F%2Flocalhost%3A3002"}}
This is the way I initialize my viewer:
function onInitialized() { //console.log("viewer inizialized");
var config = Autodesk.Viewing.createViewerConfig();
config.extensions.push('Autodesk.Viewing.ZoomWindow');
config.startOnInitialize = true;
config.theme = 'light-theme';
viewerApp = new Autodesk.Viewing.ViewingApplication('main-viewer');
viewerApp.registerViewer(viewerApp.k3D,Autodesk.Viewing.Private.GuiViewer3D ,config);
viewer = viewerApp.getViewer(config);
viewer.start();
If I use the version 4.1 of the viewer, the model can be loaded this way. Changing to 6.0 the above described error appears.
I would really appreaciate a hint to a solution of my problem!
Thanks a lot in advance!
Cheers,
Felix
With v6 and onwards, call wrapper method Viewer3D.load insteadof .loadModel so that the resource requests made to Forge endpoints can be formed properly:
viewer.load('https://developer.api.autodesk.com/derivativeservice/v2/derivatives/urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c2IyMzMvd2Fycmlvci4zZHM/output/warrior.3ds.svf');
or simply:
viewer.start(svfUrl)
Code sample: https://jsfiddle.net/dukedhx/9qncbuLt
Related
function newMarkupGUI(viewer, options) {
Autodesk.Viewing.Extension.call(this, viewer, options);
thisViewerId = options.id;
this.viewer.loadExtension("Autodesk.Viewing.MarkupsCore").then(() => {
let extension = this.viewer.getExtension("Autodesk.Viewing.MarkupsCore");
extension.enterEditMode();
console.log(extension.enterEditMode());
});
}
When I am inside my main js file where I initialize the viewer, I am able to access functions such as enterEditMode() like so:
var extension = viewer.getExtension("Autodesk.Viewing.MarkupsCore");
extension.enterEditMode();
This works. But inside my extension called newMarkupsGUI, it seems getExtension() does not work. I am confused about how this all works, as the documentation is pretty sparse. I would rather keep my extension separate and not hard code the functionality of markups where I am initializing the viewer. Any help would be appreciated, thank you.
I think your problem is related to the viewer reference. You don't need to use this.viewer if you have your viewer as function parameter.
When using viewer.loadExtension().then() the loaded extension is returned in the promise.
You can do something like that :
viewer.loadExtension("Autodesk.Viewing.MarkupsCore").then((markupExtension) =>
{
markupExtension.enterEditMode();
});
The following is my runtime enviroment:
Angular CLI version 6.
ng-fullcalendar version 1.6.2.
fullcalendar vesion 3.6.1
HTML code:
<div *ngIf="calendarOptions">
<ng-fullcalendar
#ucCalendar
[options]="calendarOptions"
(select)="select($event.detail)"
(eventClick)="eventClick($event.detail)"
(eventDrop)="updateEvent($event.detail)"
(eventResize)="updateEvent($event.detail)"
[(eventsModel)]="events"
(viewRender)="loadEvents($event.detail)"
></ng-fullcalendar>
</div>
Component code:
this.events = resp.data.items.map(item => ({
start: moment(item.startTime).toDate(),
end: moment(item.toTime).toDate(),
item
}));
When I try to load events, it shows this error:
core.js:1673 ERROR TypeError: Cannot read property 'footprint' of undefined
at HTMLDivElement.<anonymous> (fullcalendar.js:5773)
at Function.each (jquery.js:381)
at jQuery.fn.init.each (jquery.js:203)
at constructor.renderFgSegEls (fullcalendar.js:5768)
at constructor.renderFgRanges (fullcalendar.js:5668)
at constructor.render (fullcalendar.js:5652)
at members.constructor.executeEventRender (fullcalendar.js:6559)
at constructor.executeEventRender (fullcalendar.js:17772)
at Object.func (fullcalendar.js:8294)
at constructor.runTask (fullcalendar.js:2667)
This might not be the solution but it is a workaround. I had the same error as yours but I'm running FullCalendar v3.10.1.
The issue might not be in your code but in the jQuery version you are running. FullCalendar broke when I went from jQuery v3.2.1 to v3.5.1.
I reverted back to jQuery v3.4.1 and it's working again.
For those that for whatever reason need jQuery#^3.5.0, you can use similar method described in the jQuery issue describing 3.5 incompatible with FullCalendar 3. The code fixing this problem can be found at the top of this jsfiddle:
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi;
jQuery.htmlPrefilter = function( html ) {
return html.replace( rxhtmlTag, "<$1></$2>" );
};
But please be aware that this functionality was removed from jQuery as a security fix and by using this, you're exposing yourself to that attack vector again.
"Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT" was working with viewer version 6, but when I upgrade viewer version to 7.*, its not working.
I have tried to handle "Autodesk.Viewing.GEOMETRY_LOADED_EVENT", and then call the model.getObjectTree() function, but I get the following error
{instanceTree: null, maxTreeDepth: 0, err: undefined}
How can I handle the object_tree_created event for viewer 7 in my code?
Obviously the model database (which contains object tree data) failed to load (and hence the object tree event was not fired and the object tree was not accessible) and it could have been for incorrect code or networking. Did you get other errors especially network interruptions in your browser's dev tools when loading the model? What is your code to load the model? If loading from Forge did you follow the migration guide and here to use loadDocumentNode?
Autodesk.Viewing.Initializer({ env: 'AutodeskProduction', getAccessToken}, () => {
const viewer = new Autodesk.Viewing.GuiViewer3D(container);
Autodesk.Viewing.Document.load(urn, viewerDocument =>{
var defaultModel = viewerDocument.getRoot().getDefaultGeometry();
viewer.loadDocumentNode(viewerDocument, defaultModel);
I'm trying to implement chipmunk physics engine for a cocos2d-js game. I'm getting the following error when i run it.
jsb: ERROR: File Y:\Documents\cocos\PrebuiltRuntimeJs\frameworks\js-bindings\bindings\auto\jsb_cocos2dx_auto.cpp: Line: 2143, Function: js_cocos2dx_Node_setPhysicsBody
Invalid Native Object
JS: D:/PROJECTS/cocos/Sliderule/runtime/win32/../../src/app.js:32:Error: Invalid Native Object
Here is the code i'm working with
`init:function () {
this._super();
var size = cc.winSize;
this.rect1 = new cc.Sprite(res.null_png,cc.rect(0,0, 200, 25));
this.rect1.setColor(cc.color(255,50,50,1));
this.rect1.setPosition(size.width/2, size.height-12.5);
this.rect1._setAnchorX(0.5);
this.rect1._setAnchorY(0.5);
this.rectbody1 = new cp.Body(1,cp.momentForBox(1,this.rect1.getContentSize().width, this.rect1.getContentSize().height));
this.rectbody1.p = cc.p(size.width/2, size.height-12.5);
this.space.addBody(this.rectbody1);
this.rectshape1 = new cp.BoxShape(this.rectbody1, this.rect1.getContentSize().width - 14, this.rect1.getContentSize().height);
this.space.addShape(this.rectshape1);
this.rect1.setPhysicsBody(this.rectbody1);
this.addChild(this.rect1,1);
`
I get the problem when setting the body to the sprite. Thanks in Advance.
This error message usually appears because of a missing retain(). You have to explicitly set sprites to be kept by the native system (Android, iOS) otherwise it's not valid after some time. And then, if you don't need it anymore: release it.
Try:
this.rect1.retain()
after you created the sprite. And then
this.rect1.release()
when you don't need it anymore.
I had this code previously working while using the StorageClient.dll:
CloudBlobContainer container = new CloudBlobContainer(courseName.ToLower(), blobClient);
container.CreateIfNotExist();
When upgrading to the Storage.dll and using the Storage.Blob I am unable to call the CreateIfNotExists method with empty parameters. I have looked at the documentation here http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudblobcontainer.createifnotexists.aspx
There are now 2 constructors:
CloudBlobContainer.CreateIfNotExists (BlobContainerPublicAccessType, BlobRequestOptions, OperationContext)
CloudBlobContainer.CreateIfNotExists (BlobRequestOptions, OperationContext)
I have attempted to creat the BlobRequestOptions and OperationContext and pass them in as follows but without joy:
CloudBlobContainer container = blobClient.GetContainerReference(courseName.ToLower());
var bro = new BlobRequestOptions();
var oc = new OperationContext();
container.CreateIfNotExist(bro,oc);
Any idea of what I am doing wrong here?
You can still call it as CreateIfNotExists(), since those arguments have default values. Also please note that GetContainerReference requires a name to be passed in, not a URL.